Commit 79fd669
fix: actually emit lazy Prism language chunks via import.meta.glob
The previous attempt removed /* @vite-ignore */ expecting Rollup to glob
the bare-specifier template `prismjs/components/prism-${lang}.js` and emit
one chunk per language. Rollup only globs template-literal dynamic imports
with a relative prefix (./ or ../), so the import was left unresolved in
production — `Prism.languages.<lang>` stayed undefined for every language
not statically pulled in by @lexical/code (bash, splunk-spl, ruby, go,
yaml, …) and code blocks rendered without highlighting.
Switched to import.meta.glob, Vite's officially supported mechanism for
variable-keyed dynamic imports. Rollup now emits one lazy chunk per
language (verified: dist/js/chunks/prism-splunk-spl.js etc., bundled call
site rewrites to import("./chunks/prism-X.js") via __vitePreload).
Excluded *.min.js siblings to avoid emitting unused duplicates.
Reported on community for splunk-spl after 0.55.1 patch:
https://community.anytype.io/t/bash-code-snipped-highlight-broke/30673
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9d9ae7f commit 79fd669
1 file changed
Lines changed: 13 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
16 | 22 | | |
17 | 23 | | |
18 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
19 | 28 | | |
20 | 29 | | |
21 | 30 | | |
| |||
0 commit comments