Rolldown, chunking and performance

Vite · Expert · 15 min

Large apps hit slow cold starts and oversized bundles; fixing them needs knowledge of the toolchain.

Vite 8 replaced the esbuild + Rollup pair with Rolldown (bundler) and Oxc (parser, transformer, minifier), both written in Rust by the VoidZero team. One toolchain for dev pre-bundling and production means more consistent behaviour and much faster builds. Config moved accordingly: build.rolldownOptions replaces build.rollupOptions (still accepted as a deprecated alias), and the oxc option replaces esbuild.

Chunking: by default, Rolldown creates one chunk per entry and per dynamic import, plus shared chunks. To group modules yourself, use output.codeSplitting.groups, each with a name and a test (regex or function), plus optional size limits like minSize, maxSize and priority. The Rollup-era manualChunks function still works but is deprecated. Splitting vendor code into stable chunks improves cache hit rates across deploys; splitting too much causes request waterfalls.

Dev server performance:

  • Audit slow plugins: vite --debug plugin-transform or vite-plugin-inspect.
  • Avoid barrel files (index.ts re-exporting hundreds of modules): every import loads them all.
  • Use explicit file extensions in imports to reduce resolution work, and server.warmup.clientFiles to pre-transform frequently used files.

Bundle analysis: rollup-plugin-visualizer or vite-bundle-analyzer, then replace heavy dependencies, lazy-load routes, and check that tree-shaking works (sideEffects: false in packages).

Example

// vite.config.js
import { defineConfig } from "vite";

export default defineConfig({
  build: {
    rolldownOptions: {
      output: {
        codeSplitting: {
          groups: [
            { name: "react", test: /node_modules[\\/](react|react-dom|scheduler)[\\/]/, priority: 20 },
            { name: "vendor", test: /node_modules/, priority: 10 },
          ],
        },
      },
    },
  },
  server: {
    warmup: { clientFiles: ["./src/components/Layout.tsx", "./src/routes/*.tsx"] },
  },
});
// $ npx vite build
// dist/assets/index-BO0so3wH.js    0.74 kB
// dist/assets/vendor-C0txrztE.js  19.21 kB
// $ npx vite --debug plugin-transform   # which plugins are slow?

Remember

  • Vite 8: Rolldown + Oxc; rolldownOptions and oxc replace rollupOptions and esbuild
  • codeSplitting.groups controls chunks; manualChunks is deprecated
  • Barrel files and slow plugins are the usual dev bottlenecks
  • Analyze bundles before optimizing them

Watch out for

  • Splitting every dependency into its own chunk, creating dozens of small requests.

Check yourself

  1. Which option replaces `build.rollupOptions` in Vite 8?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: vite.dev/guide/performance

Builds on

Unlocks

Nothing builds on this yet.