-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
9.0.0-alpha.0: 'ERR_MODULE_NOT_FOUND' 'use-sync-external-store/with-selector' from react-redux/dist/react-redux.mjs within Vitest #2063
Comments
Y'know, as soon as I saw the headline I knew what the issue was here. We really need THANK YOU for reporting this! (I mean, I hate seeing more issues, but this is why we published an alpha.) |
@markerikson I just thought that Vite prebuilds the dependency package as ESM, so this problem does not occur on the dev-server. I thought that the ESM error that occurs in Jest would not occur because Vitest does the same thing, but it seems that is not the case. Vite and Bun are the only effective tools for CJS/ESM compatibility, so it's worth learning more about them now. |
For what it's worth, I'm having the same problem with webpack when simply starting the dev server. So I haven't been able to test react-redux 9 so far because my app doesn't build at all with it. |
The changes in facebook/react#26230 seem to do the trick, but there's no sign of when that might be merged in. For now, I'm having to use patch-package to add the changes myself (if you want to do this too, note that patch-package will exclude package.json by default, so needs that config to be overridden) |
Looks like changing the imports to be |
Nice! |
Fix is out in https://github.com/reduxjs/react-redux/releases/tag/v9.0.0-beta.0 - please let me know if there's any other issues! |
@markerikson Thanks! |
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
What is the current behavior?
react-redux@9.0.0-alpha.0
publish as a.mjs
and importuse-sync-external-store/with-selector' without
.js` ext.That doesn't satisfy Node.js's ESM convention so lead causing bellow error.
What is the expected behavior?
Import modules following Node runtime rules about treat ESM and then disappier this error.
There is reproduction here.
https://github.com/laststance/vite-rtk-query
Installation
Which browser and OS are affected by this issue?
No response
Did this work in previous versions of React Redux?
The text was updated successfully, but these errors were encountered: