Skip to content

Commit 9ce278b

Browse files
RuitingMaclaude
andcommitted
Build: vite.worker.format='es' so render-worker can import shared modules
Default Vite worker format is `iife`, which forbids code splitting; the score render worker imports renderScoreUncached from render.ts, which gets code-split, so the build broke with: Invalid value "iife" for option "worker.format" - UMD and IIFE output formats are not supported for code-splitting builds. ES module workers fix this and are supported in every browser our runtime guard already checks for (the worker is feature-detected and falls back to main-thread render on older targets). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a4d4f74 commit 9ce278b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

astro.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,13 @@ export default defineConfig({
99
// Order: mdx first so .mdx essays can import components; font-subset runs
1010
// at astro:build:done, after everything else has emitted HTML.
1111
integrations: [mdx(), fontSubset()],
12+
vite: {
13+
worker: {
14+
// ES module workers — required because src/lib/score/render-worker.ts
15+
// imports from render.ts (which is code-split). Vite's default `iife`
16+
// worker format would refuse the import; `es` lets the worker chunk
17+
// share modules with the main bundle.
18+
format: 'es',
19+
},
20+
},
1221
});

0 commit comments

Comments
 (0)