Back to all fixes
CuratedTypeScriptVite 8local
build.rollupOptions.output.manualChunks throws validation error under rolldown-vite
Problem
Using `build.rollupOptions.output.manualChunks` (either the object or function form) in a Vite config that uses rolldown-vite fails the build with a config validation error. The same config works fine under classic Vite/Rollup.
Solution
typescript
`manualChunks` is intentionally unsupported by rolldown and will not be implemented (closed as wontfix). Replace it with `advancedChunks`:
```js
export default {
build: {
rollupOptions: {
output: {
advancedChunks: {
groups: [{ name: 'vendor', test: /\/react(?:-dom)\// }]
}
}
}
}
}
```
`test` takes a regex matched against the module id, and `groups` replaces the manualChunks map/function. Note `rollupOptions` still works for migration but is deprecated in favor of `rolldownOptions` going forward. Note: on vite@8.1.3+, advancedChunks emits a deprecation warning pointing at the newer codeSplitting option; advancedChunks still works but prefer codeSplitting going forward.