Replies: 8 comments 1 reply
-
copied the exact same minimal replication to next to validate, and it works no problem (styling all broken, but it compiles and loads): https://github.com/praetoros/error-remix-cf-pages-lexical-prism-working-next |
Beta Was this translation helpful? Give feedback.
-
Have nailed down the cause to be:
Removing either does not resolve the issue - it looks like having anything imported from "@lexical/code" causes the bundler breakdown documented above. Sorry if I'm posting nonsense here: out of my depth with this stuff! |
Beta Was this translation helpful? Give feedback.
-
I'm getting this exact error when using Vite, which appears to use the same bundler (Rollup) that Remix does. Next.js does not use the same bundler; perhaps the issue is with how Rollup deals with this module. |
Beta Was this translation helpful? Give feedback.
-
I made a minimum replication that tests out whether or not the error is coming from the bundler beneath it: it does not appear so, as I'm able to get three different bundler systems (two of which are used by Vite) able to import from |
Beta Was this translation helpful? Give feedback.
-
@praetoros @Flarp i am running into this also while using remix with cloudflare-workers. this looks like it must be related to facebook/lexical#5828, but i’ve tried installing lexical 0.14.1, 0.14.3 (right before that change), and 0.14.5 (after that change) and they all result in:
i hacked around this by adding import Prism from 'prismjs/components/prism-core';
// …
if (typeof globalThis.Prism === 'undefined') {
globalThis.Prism = Prism;
} note that this only worked when i was able to fully defer all lexical imports by keeping them contained to a single TextEditor component and using a dynamic import + React.lazy to load and render that component as needed. (i also needed to add |
Beta Was this translation helpful? Give feedback.
-
I get the same error, can't figure out how to use |
Beta Was this translation helpful? Give feedback.
-
@praetoros @acusti I think this should be reported as a bug to |
Beta Was this translation helpful? Give feedback.
-
I was able to get this solved by importing Prism before import 'prismjs';
import 'prismjs/components/prism-javascript';
...
import { CodeHighlightNode, CodeNode } from '@lexical/code'; |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Coming to the remix discussions as the code looks to be working outside of the remix environment to my eyes.
Link to minimal reproduction: https://github.com/praetoros/error-remix-cf-pages-lexical-prism
Based off the code that is working here: https://codesandbox.io/p/sandbox/lexical-rich-text-example-5tncvy
Looking at the minified bundle:
Beta Was this translation helpful? Give feedback.
All reactions