lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Bug: Uncaught Error: Dynamic require of "lexical" is not supported

Open stonix26 opened this issue 3 years ago • 6 comments

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.

Screenshot from 2023-02-10 13-35-50

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?

stonix26 avatar Feb 10 '23 05:02 stonix26

There was a related issue with the 0.7.8 release. Upgrading to the latest version should fix this issue.

thegreatercurve avatar Feb 10 '23 07:02 thegreatercurve

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.

stonix26 avatar Feb 10 '23 08:02 stonix26

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.

thegreatercurve avatar Feb 10 '23 12:02 thegreatercurve

Closing this as I don't think it's Lexical specific and I can't seem to replicate it in my Next.js project.

thegreatercurve avatar Feb 10 '23 13:02 thegreatercurve

Hi @stonix26, I'm facing a similar issue here, did you manage to resolve it?

lluiscab avatar Sep 26 '23 08:09 lluiscab

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 😄

stonix26 avatar Sep 28 '23 13:09 stonix26