Bug: Uncaught Error: Dynamic require of "lexical" is not supported
I created a custom editor component and bundled it with Tsup inside my Turbo repo. It successfully bundled, but when I tried running it in Storybook, it shows me this console error: Uncaught Error: Dynamic require of "lexical" is not supported. I also tried running it inside my NextJS app, but it still crashes my app with this same error.

Lexical version: "@lexical/react": "^0.8.0", "lexical": "^0.8.0" Tsup version: "tsup": "^6.5.0" React version: "react": "^18.2.0"
... and here's my tsup config inside my package.json:
"tsup": {
"entry": [
"src/index.ts"
],
"format": [
"cjs",
"esm"
],
"dts": true,
"keepNames": true,
"splitting": true,
"sourcemap": true,
"minify": true,
"clean": true
},
What am I missing in order to fix this?
There was a related issue with the 0.7.8 release. Upgrading to the latest version should fix this issue.
There was a related issue with the 0.7.8 release. Upgrading to the latest version should fix this issue.
Yes, I use version 0.8.0, the latest as of this writing.
I'm not sure in that case. We've definitely not made any amendments to the module logic or changed any of the imports in that file.
Closing this as I don't think it's Lexical specific and I can't seem to replicate it in my Next.js project.
Hi @stonix26, I'm facing a similar issue here, did you manage to resolve it?
Hi @stonix26, I'm facing a similar issue here, did you manage to resolve it?
I haven't resolved it. I switched to Tiptap editor as I have no time investigating it that time 😄