-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: (0 , _hashIt2.default) is not a function #344
Comments
@dcowan-e-courier can you check which version of |
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:
|
@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! |
@siawyoung @dcowan-e-courier this does seem to be related to the export mapping on the |
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? |
@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. 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. |
@chris-pardy I cloned the project, then copied the src files to my project and "yarn add"-ed the required dependencies (including hash-it) |
@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. |
When calling run getting this error. This is implementing the simple first example provided in the documentation in a react web app
The text was updated successfully, but these errors were encountered: