fix: move Prism global setup to entry-point module

The previous approach imported prismjs component files directly in
MarkdownComposer.tsx.  In Vite dev mode, each component is served
as a separate ESM module whose IIFE references a bare 'Prism' global
that doesn't exist yet, crashing the app.

Fix: create a dedicated prismSetup module that imports prismjs and
assigns globalThis.Prism, then import it from the renderer entry
point (main.tsx) before any component that loads @lexical/code-prism.
ESM evaluation order guarantees the global is set before the
tokenizer captures its reference.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-25 20:03:02 +01:00
co-authored by Copilot
parent 860876172e
commit 5dc86426b1
3 changed files with 16 additions and 23 deletions
+1
View File
@@ -1,6 +1,7 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import '@renderer/lib/prismSetup';
import App from '@renderer/App';
import '@renderer/styles.css';