mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-06 19:58:43 +02:00
fix: resolve Prism CJS loading crash in Vite dev mode
Remove the prismSetup module that imported prismjs directly — it caused Vite to pre-bundle prismjs into a separate chunk from @lexical/code-prism, breaking the CJS require chain. Language components tried to call Prism.languages.extend() before the base grammars were available, crashing the app. Instead, add optimizeDeps.include for prismjs and @lexical/code-prism so Vite pre-bundles them together, preserving the correct CJS evaluation order within a single chunk. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -33,6 +33,12 @@ export default defineConfig({
|
||||
build: {
|
||||
outDir: 'dist/renderer',
|
||||
},
|
||||
optimizeDeps: {
|
||||
// @lexical/code-prism depends on prismjs + its language components via
|
||||
// CJS require(). Vite must pre-bundle them together so that the Prism
|
||||
// global is available when component IIFEs execute.
|
||||
include: ['prismjs', '@lexical/code-prism'],
|
||||
},
|
||||
plugins: [react(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user