-
Notifications
You must be signed in to change notification settings - Fork 27
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
Named export not found error
with upgrade to Vite 5 because of lexical packages still being CJS (instead of ESM)
#68
Comments
Vite believes it is not their issue. NodeJS is not able to resolve the CJS module, so Vite5 can't do anything about it. vitejs/vite#14332 [CJS named imports in an ESM library] |
There is an open |
A workaround to resolve this issue is to change the import statement from
to
|
Here is the regular expressions to assist with conversion presented in the last comment: Step-1 - ignore type import manually Step-2 - ignore type import manually Step-3 - have to keep refreshing and running it till all instances are covered |
resolved with 0.4.0 |
Sample error - this error occurs on every import from a lexical package
Error when evaluating SSR module /@fs/Users/umar/Documents/Projects/lexical/svelte-lexical/packages/svelte-lexical/src/components/toolbar/BlockFormatDropDown/HeadingDropDownItem.svelte: failed to import "@lexical/selection"
|- SyntaxError: [vite] Named export '$setBlocksType' not found. The requested module '@lexical/selection' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@lexical/selection';
const {$setBlocksType} = pkg;
The text was updated successfully, but these errors were encountered: