Comments (8)
@MohHamoud this makes sense since we transform the source from modules to common / require. As part of that babel is doing a default import transformation. Then the webpack resolution is giving us the wrong version of the hash-it library.
from json-rules-engine.
@dcowan-e-courier can you check which version of hash-it
you have installed?
from json-rules-engine.
I'm seeing this error too. If it helps, I have the same code running successfully in a Node environment, but running it in a browser environment (Chrome) produces the above error. The exact version of hash-it on both environments:
hash-it@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/hash-it/-/hash-it-6.0.0.tgz#188df5a8ca2f8e036690e35f2ef88bd9417ff334"
integrity sha512-KHzmSFx1KwyMPw0kXeeUD752q/Kfbzhy6dAZrjXV9kAIXGqzGvv8vhkUqj+2MGZldTo0IBpw6v7iWE7uxsvH0w==
from json-rules-engine.
@dcowan-e-courier if it helps, I tried running this in a fresh NextJS environment (using create-next-app) instead of create-react-app. That works. My guess is it has something to do with the Webpack bundling in create-react-app and how it messes up default exports. I don't have time to explore this further but hopefully it unblocks you!
from json-rules-engine.
@siawyoung @dcowan-e-courier this does seem to be related to the export mapping on the hash-it
package and how something like webpack is resolving that.
from json-rules-engine.
I am having the same error in an existing project, I reproduced the issue by creating a project using create-react-app as @siawyoung mentioned, is there a fast way to fix it?
I understand that create-next-app creates a next.js application, which I don't prefer doing.
from json-rules-engine.
@MohHamoud I haven't reproduced this issue since it's more related to webpack than json-rules-engine but...
The issue is likely that the webpack version that create-react-app is using doesn't understand the export mapping in hash-it's package.json.
Option 1: Downgrade hash-it - depending on your package manager of choice you may be able to force the resolution of hash-it to an older version that doesn't have the export mapping.
Option 2: Upgrade webpack. I'm not sure which version of webpack create-react-app uses but the export mapping is a fairly new package.json feature so we older webpack versions may not support it. This will likely requiring ejecting.
Overall I'd probably go the Option 2 route. specifically because create-react-app is no longer supported by the react team. If you don't wish to go with one of the various react-ecosystem setups then you're best bet is likely a roll-your-own approach.
from json-rules-engine.
@chris-pardy I cloned the project, then copied the src files to my project and "yarn add"-ed the required dependencies (including hash-it)
it worked fine, without specifying the version of the hash-it nor the webpack
from json-rules-engine.
Related Issues (20)
- Adding path values to events HOT 2
- is this project still active HOT 9
- Not able to resolve JsonPath when it includes a where condition HOT 1
- Operator availability - between operator HOT 1
- OnSuccess/OnFailure properties as part of the rule - Security Issue
- Slow performance while having large array of facts. HOT 9
- How to feed engine multiple facts as array! HOT 1
- Complex rule for the fact HOT 2
- woops HOT 1
- Feat: Type-safety using a FactTypeMapping HOT 1
- Is it possible to make sure that a fact triggers at most one rule? HOT 2
- Error: Cannot find module 'lodash' HOT 1
- problems with the execution of my rules HOT 4
- Example issue - undefined parameter HOT 1
- RuleResult class missing from type declarations HOT 1
- What the best way to launch the rule engine
- Parent child rule
- Ability to stop rules execution after success for array of inputs
- How to create multiple 'aggregate' facts on a 'parent' object calculated from child objects (composition)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-rules-engine.