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.
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user