Update to use a function

This commit is contained in:
khalid@traclabs.com
2026-05-23 04:10:22 -05:00
parent 8294c47f74
commit 3277bbe5ec

View File

@@ -288,11 +288,21 @@ export default defineConfig({
// the build fails and tells you exactly which chunk overflowed. // the build fails and tells you exactly which chunk overflowed.
rollupOptions: { rollupOptions: {
output: { output: {
manualChunks: { // Rolldown (Vite 8) only accepts a function here — object form was Rollup-only.
'transformers': ['@huggingface/transformers'], manualChunks(id) {
'konva': ['konva', 'react-konva', 'use-image'], const groups = [
'react-vendor': ['react', 'react-dom'], ['transformers', '@huggingface/transformers'],
'filerobot': ['react-filerobot-image-editor'], ['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;
}
}
}
}, },
}, },
}, },