-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Suddenly got compilation error with Typescript #459
Comments
Sounds like you have an old version of immer. Can you please make sure that immer v6 is used? |
Thanks for the reply. |
That doesn't sound right, because modern package managers shouldn't be installing Do you also have a copy of Immer under |
Having two versions of immer itself would not be something your package manager or bundler could not handle - but typescript can only handle one version of a package. So if you have installed immer@5 somewhere else in your project, it will use the type definitions of immer 5. Try |
I'm using npm, so I used npm-why and yeah, react-dev-utils is using an old version of immer : npx npm-why immer Who required immer: orca-client > @reduxjs/toolkit > immer@6.0.2 But the thing is, I need react-scripts (don't want to eject), and the same setup is working perfectly on my Mac machine. Weird.. edit: typo |
Ew. That's weird. Why in the world is May need to file an issue in the CRA repo. Ultimately, though, this isn't a bug with Redux Toolkit, so I'm going to go ahead and close this. |
You could try to use forced module resolution (immer is pretty backwards compatible, so react-dev-utils should work fine with immer6) for that. Yarn can do that out-of-the-box, npm apparently needs a package for that: https://github.com/rogeriochaves/npm-force-resolutions |
It worked, thanks! I suppose there's no less hacky way to do it? I'm not entirely comfortable |
Well, right now I'd guess that your Mac builds a version with immer6 and your other PC built it with immer1 until now, so having a constant immer version is definitely less hacky ;) |
true :) thanks for the help, much appreciated. |
Also, make sure to commit your lock files into version control. This sounds like one of those errors that only occur without the |
There's nothing "hacky" about it. Also, out of curiosity, what package manager and version are you using atm? |
Sure, I'm using npm 6.14.4 |
Oddly enough, the lock file is in git from the start. I suppose it has something to do with the fact that the W10 environment at work is a bit different / older. |
That could only be explained by a VERY old npm version that doesn't honor the package-lock.json. Weird. I know why I prefer yarn ^^ |
Hi,
My setup is W10 with CRA 3.4.0, RTK 1.3.2 (same error with 1.3.1), using TypeScript 3.8.3
When I try to launch my React App I get a compilation error:
Attempted import error: 'enableES5' is not exported from 'immer'.
in .../redux-toolkit.esm.js
any ideas? I've got the repo working without any problems on my other machine (MacOS) but the packages.json file is identical. I've tried rebuilding the whole node_modules dir to no avail... any ideas?
The text was updated successfully, but these errors were encountered: