Back to Nx

Rename Rollup Options To Rolldown Options

packages/vite/src/migrations/update-23-0-0/rename-rollup-options-to-rolldown-options.md

23.0.01.9 KB
Original Source

Rename rollupOptions to rolldownOptions in Vite Config Files

Renames the rollupOptions property to rolldownOptions inside vite.config.{js,ts,mjs,mts,cjs,cts} files. Vite 8 replaced Rollup with Rolldown as its production bundler; rollupOptions is accepted as a deprecated alias but logs a warning and may produce precedence surprises when both keys are present. The migration covers top-level usage as well as nested environments.<env>.build.rollupOptions.

The migration only touches files matching vite.*config*.{js,ts,mjs,mts,cjs,cts}. Helper modules imported by your config and rollupOptions declared elsewhere need to be renamed by hand.

Sample Code Changes

Top-level rename inside build.

Before
ts
export default defineConfig({
  build: {
    rollupOptions: {
      external: ['react'],
    },
  },
});
After
ts
export default defineConfig({
  build: {
    rolldownOptions: {
      external: ['react'],
    },
  },
});

The same rename applies inside environments.<env>.build.

Before
ts
export default defineConfig({
  environments: {
    ssr: {
      build: {
        rollupOptions: { external: ['fs'] },
      },
    },
  },
});
After
ts
export default defineConfig({
  environments: {
    ssr: {
      build: {
        rolldownOptions: { external: ['fs'] },
      },
    },
  },
});

Note: Rolldown is largely Rollup-compatible but a handful of options have different semantics. The most common one to check after this migration: output.manualChunks only accepts a function in Rolldown (the object-of-globs form is invalid). See tools/ai-migrations/MIGRATE_VITE_8.md (created by a sibling migration) for the full Vite 8 upgrade checklist.