Vite 8 manualChunks: Migrate Rollup Splits to Rolldown codeSplitting
Vite 8 changes the bundler underneath the build from the older Rollup-oriented path to Rolldown. If your vite.config contains build.rollupOptions.output.manualChunks, migrate that split instead of assuming the old object syntax will keep working: Vite 8 no longer supports the object form, and the function form is deprecated.
The replacement is build.rolldownOptions.output.codeSplitting with explicit groups:
import { defineConfig } from 'vite';
export default defineConfig({ build: { rolldownOptions: { output: { codeSplitting: { groups: [ { test: /node_modules\/(react|react-dom)/, name: 'framework', }, ], }, }, }, },});The regex and chunk name are examples. Choose groups from the dependencies and loading behavior of your application, then verify the generated output rather than treating every old manualChunks map as a mechanical rename.
Map the old and new configuration boundaries
An older Vite configuration may look like this:
export default defineConfig({ build: { rollupOptions: { output: { manualChunks: { vendor: ['react', 'react-dom'], }, }, }, },});In Vite 8, move the underlying bundler options and express the split as a codeSplitting.groups rule:
export default defineConfig({ build: { rolldownOptions: { output: { codeSplitting: { groups: [ { test: /node_modules\//, name: 'vendor', }, ], }, }, }, },});The migration guide also lists build.rollupOptions as deprecated in favor of build.rolldownOptions. Update the outer option at the same time so a later Vite upgrade does not leave the old compatibility name scattered through the config.
Do not blindly split every dependency
Rolldown’s manual code-splitting documentation warns that moving modules between chunks can change execution behavior. A broad node_modules group is easy to write, but it can create a large vendor chunk, capture dependencies recursively, or alter the order in which modules initialize.
Use a staged migration:
- Record the old build’s chunk names and the routes that load them.
- Replace one
manualChunksrule with one narrowcodeSplittinggroup. - Run the production build and inspect
dist/assets. - Load the initial route and every route that uses a dynamic import.
- Check side effects, circular imports, and cache headers before adding another group.
Rolldown may also emit a runtime chunk when manual splitting needs a stable execution order. That is not automatically a regression. The question is whether the resulting application loads and initializes correctly under the deployment’s asset and cache rules.
Verify the build instead of the config alone
Run the same build command used by CI, then inspect both the build output and the application behavior:
pnpm vite buildfind dist/assets -maxdepth 1 -type f | sortFor a package script, use pnpm build instead. Check the generated HTML for the expected entry assets, open a page that loads a lazy chunk, and test a fresh browser profile so a previously cached chunk does not hide a broken import.
If the project still targets an older Vite release, do not copy the Vite 8 configuration into it without checking that release’s supported options. Keep the migration in the same change as the Vite upgrade, or guard the configuration in a way the project can test in both environments.
FAQ
Is manualChunks removed in Vite 8?
The object form of build.rollupOptions.output.manualChunks is no longer supported. The function form is deprecated. Vite directs users to Rolldown’s codeSplitting option for manual chunk rules.
What replaces build.rollupOptions?
Use build.rolldownOptions for direct Rolldown configuration. Vite lists build.rollupOptions as a deprecated name during the Vite 8 migration.
Will codeSplitting always improve performance?
No. It changes chunk boundaries, not a guaranteed performance outcome. Test initial loading, lazy routes, caching, and module initialization with the actual application and deployment headers.
References:
Report a typo or broken link, or suggest a related topic.