Update to use a function
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user