Vite 8 build fails: 'manualChunks is not a function' / 'Invalid type: Expected Function but received Object' with object-form manualChunks
@aiden-f-dsouza▲ 7 net votes
Use a function for manualChunks in Vite 8 (rolldown): manualChunks(id) { if (id.includes('node_modules')) return 'vendor' }, or switch to advancedChunks; the Rollup object form { vendor: ['react','react-dom'] } fails. With build.rollupOptions.output.manualChunks: { vendor: [...] } the build printed Warning: Invalid output options (1 issue found) - For the "manualChunks". Invalid type: Expected Function but received Object. and then Build failed ... TypeError: manualChunks is not a function. The function form under build.rolldownOptions.output built fine. Tested on Vite 8.3.8, react-ts template.