pacocoursey / cmdk

Fast, unstyled command menu React component.
https://cmdk.paco.me
MIT License
9.98k stars 287 forks source link

Module not found error with use-sync-external-store in version 1.0.3 and webpack #327

Closed czue closed 3 weeks ago

czue commented 3 weeks ago

Getting the following error after installing 1.0.3

ERROR in ./node_modules/cmdk/dist/index.mjs 1:217-286
Module not found: Error: Can't resolve 'use-sync-external-store/shim' in '/home/runner/work/myapp/node_modules/cmdk/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"').

I've been able to make some changes to my webpack.config.js file to workaround this. specifically adding:

fallback: {
      'use-sync-external-store/shim': require.resolve('use-sync-external-store/shim')
    }

to my resolve section and installing use-sync-external-store. just wondering if this is the expected behavior?

yusepjaelani861 commented 3 weeks ago

maybe after update this package, having problem.

I was solve the problem after editing file on node_modules/cmdk/dist/index.mjs and edit specific line on import data from 'use-sync-external-store/shim' to 'use-sync-external-store'

I using typescript, so I was edited on index.mjs.

drewhoffer commented 3 weeks ago

Reverting to 1.0.2 fixed for me for the time being: #326

parhammmm commented 3 weeks ago

I'm getting a similar issue with vitest. Reverting to 1.0.2

Directory import '/assistant/node_modules/use-sync-external-store/shim' is not supported resolving ES modules imported from /assistant/node_modules/cmdk/dist/index.mjs 

Did you mean to import "use-sync-external-store/shim/index.js"?
pacocoursey commented 3 weeks ago

Duplicate #326