From 2d3c2bfc6f7e825444791463961bdbf8fb1c8cc2 Mon Sep 17 00:00:00 2001 From: Till JS Date: Thu, 9 Apr 2026 01:33:03 +0200 Subject: [PATCH] fix(local-llm): set Vite worker.format='es' for code-splitting support The Phase 3 build failed at the worker bundling step with: "Invalid value 'iife' for option 'worker.format' - UMD and IIFE output formats are not supported for code-splitting builds." Vite defaults workers to IIFE format which can't handle code-split imports. @mana/local-llm's new worker.ts imports @huggingface/ transformers, which itself is internally code-split into many chunks (the ONNX runtime, the model classes, the tokenizer families, the lazy backend selectors). IIFE has no way to load those at runtime. Switch the web app's vite.config.ts to `worker: { format: 'es' }`. Module workers are supported in every browser that supports WebGPU (Chrome 80+, Edge 80+, Safari 15+), so no users lose support. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/mana/apps/web/vite.config.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/mana/apps/web/vite.config.ts b/apps/mana/apps/web/vite.config.ts index f4164ebd2..fc9740c2b 100644 --- a/apps/mana/apps/web/vite.config.ts +++ b/apps/mana/apps/web/vite.config.ts @@ -56,6 +56,16 @@ export default defineConfig({ port: 4173, strictPort: true, }, + worker: { + // Vite defaults to IIFE worker format, which does not support code + // splitting. @mana/local-llm's worker imports transformers.js, which + // is internally code-split into many chunks. Without 'es' format the + // build fails with "Invalid value 'iife' for option 'worker.format' + // - UMD and IIFE output formats are not supported for code-splitting + // builds." All modern browsers (which we already require for WebGPU) + // support module workers. + format: 'es', + }, ssr: { // `rrule@2` ships dual CJS/ESM but its package.json has no `exports` // field, so the SvelteKit Node adapter resolves it to the CJS bundle