Skip to content
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

Module not found: Error: Can't resolve 'use-sync-external-store/shim' after updating to 2.2.3 #2801

Closed
Synoo opened this issue Sep 25, 2023 · 3 comments

Comments

@Synoo
Copy link

Synoo commented Sep 25, 2023

Bug report

Description / Observed Behavior

After updating to version 2.2.3 from 2.2.2, I get the following error:

ERROR in ../node_modules/swr/core/dist/index.mjs 3:0-68 Module not found: Error: Can't resolve 'use-sync-external-store/shim' in '/node_modules/swr/core/dist' Did you mean 'index.js'? BREAKING CHANGE: The request 'use-sync-external-store/shim' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). The extension in the request is mandatory for it to be fully specified. Add the extension to the request.

Additional Context

SWR version: 2.2.3
I saw the changelog of 2.2.3 and I think it has to do with:
Remove index.js suffix of use-sync-external-store/shim to support React Native by @malash in #2767

@chhuang
Copy link

chhuang commented Sep 25, 2023

May be related:

unhandledRejection Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/chh/Documents/GitHub/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/use-sync-external-store/shim' is not supported resolving ES modules imported from /Users/chh/Documents/GitHub/my-app/node_modules/.pnpm/[email protected][email protected]/node_modules/swr/core/dist/index.mjs

Did you mean to import [email protected][email protected]/node_modules/use-sync-external-store/shim/index.js?

@AndreasFaust
Copy link

Manually appending /index.js to the line import { useSyncExternalStore } from 'use-sync-external-store/shim'; in
node_modules/swr/core/dist/index.mjs and node_modules/swr/infinite/dist/index.mjs seems to solve it temporarily.

@huozhi
Copy link
Member

huozhi commented Sep 25, 2023

Thanks for reporting! Reverted the chang from #2767 in #2802 , landed a new patch release [email protected]. Please upgrade to the latest version 🙏

@huozhi huozhi closed this as completed Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants