From 90d82b2e8459e526f8c448dce58a4d7ce31c53f2 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 24 Apr 2026 13:11:17 +0000 Subject: [PATCH] fix(frontend): revert manualChunks grouping (regressed login payload) The manualChunks config from the previous commit over-grouped Monaco into a single `vendor-monaco` chunk. Any small utility touched by the login page graph was enough to drag the full 6.5 MB Monaco bundle into the initial preload, so the Cloudflare preview of the login page was downloading ~7 MB while production downloads ~166 KB (a ~44x regression). Reverting the manualChunks function. Without it, Rollup's default chunking splits Monaco fine-grainedly by usage pattern and the login preload drops back to ~165 KB, matching production. The OpenAI / Anthropic SDK dynamic-import refactor from the first commit stays in place (it uses await import(...), which creates its own chunks naturally and does not have this problem). Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/vite.config.js | 47 ----------------------------------------- 1 file changed, 47 deletions(-) diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 8d0759fe0b..8f49dc1ba4 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -111,53 +111,6 @@ const config = { dedupe: ['vscode', 'monaco-editor'] }, assetsInclude: ['**/*.wasm'], - build: { - rollupOptions: { - output: { - manualChunks(id) { - if (id.includes('node_modules')) { - if (id.includes('monaco-editor') || id.includes('@codingame/monaco-vscode')) { - return 'vendor-monaco' - } - if (id.includes('/openai/') || id.includes('/@anthropic-ai/')) { - return 'vendor-ai' - } - if (id.includes('@xyflow/svelte') || id.includes('d3-dag')) { - return 'vendor-flow' - } - if (id.includes('/yjs/') || id.includes('y-websocket') || id.includes('y-monaco')) { - return 'vendor-collab' - } - if (id.includes('ag-grid') || id.includes('ag-charts')) { - return 'vendor-ag' - } - if (id.includes('pdfjs-dist')) { - return 'vendor-pdf' - } - if ( - id.includes('svelte-exmarkdown') || - id.includes('/parse5/') || - id.includes('/rehype-') || - id.includes('/remark-') || - id.includes('/mdast-') || - id.includes('/micromark') - ) { - return 'vendor-markdown' - } - if (id.includes('quicktype-core')) { - return 'vendor-quicktype' - } - if (id.includes('/quill/')) { - return 'vendor-quill' - } - if (id.includes('/chart.js/') || id.includes('chartjs-')) { - return 'vendor-chart' - } - } - } - } - } - }, test: { expect: { requireAssertions: true }, projects: [