From 3277bbe5ec697a632cceb934f8cd3ccb1a10a6c3 Mon Sep 17 00:00:00 2001 From: "khalid@traclabs.com" Date: Sat, 23 May 2026 04:10:22 -0500 Subject: [PATCH] Update to use a function --- vite.config.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/vite.config.js b/vite.config.js index 44da18d..4be432a 100644 --- a/vite.config.js +++ b/vite.config.js @@ -288,11 +288,21 @@ export default defineConfig({ // the build fails and tells you exactly which chunk overflowed. rollupOptions: { output: { - manualChunks: { - 'transformers': ['@huggingface/transformers'], - 'konva': ['konva', 'react-konva', 'use-image'], - 'react-vendor': ['react', 'react-dom'], - 'filerobot': ['react-filerobot-image-editor'], + // Rolldown (Vite 8) only accepts a function here — object form was Rollup-only. + manualChunks(id) { + const groups = [ + ['transformers', '@huggingface/transformers'], + ['konva', 'konva', 'react-konva', 'use-image'], + ['react-vendor', 'react', 'react-dom'], + ['filerobot', 'react-filerobot-image-editor'], + ]; + for (const [chunk, ...packages] of groups) { + for (const pkg of packages) { + if (id.includes(`node_modules/${pkg}/`) || id.includes(`node_modules/${pkg}\\`)) { + return chunk; + } + } + } }, }, },