Rolldown: The Rust-Based Bundler Unifying Rollup and esbuild
JavaScript bundling has fragmented into multiple tools with different strengths. Rollup produces clean output but is slow. esbuild is blazing fast but limited in plugin compatibility. Vite uses both — Rollup for production, esbuild for development — creating subtle inconsistencies between environments.
Photo by Joshua Aragon on Unsplash
Rolldown aims to fix this by building a single bundler that's Rollup-compatible and esbuild-fast, written in Rust.
What Rolldown Actually Is
Rolldown is an open-source JavaScript/TypeScript bundler built in Rust by the Vite team. The project has a specific goal: replace both Rollup and esbuild inside Vite with a single unified bundler. This eliminates the dev/prod behavioral split that has been a persistent source of bugs in Vite projects.
The key design decisions:
- Rollup-compatible plugin API — existing Rollup plugins work with minimal or no changes
- Built-in transforms — TypeScript, JSX, and syntax lowering are handled natively, no separate transpiler needed
- Tree shaking — scope-level dead code elimination, matching Rollup's output quality
- Code splitting — automatic chunk splitting with the same semantics as Rollup
- Source maps — fast, accurate source map generation throughout the pipeline
Performance
Rolldown's Rust core gives it significant speed advantages over JavaScript-based bundlers. In benchmarks against real-world projects, it typically bundles 10-30x faster than Rollup while producing comparable output. Against esbuild, it's competitive on raw speed but produces better tree-shaken output.
The speed difference matters most in CI/CD pipelines and large monorepos where production builds take minutes. A project that takes 45 seconds with Rollup might finish in 2-3 seconds with Rolldown.
Getting Started
Install Rolldown and create a basic configuration:
npm install rolldown --save-dev
Create rolldown.config.js:
import { defineConfig } from 'rolldown'
export default defineConfig({
input: 'src/index.ts',
output: {
dir: 'dist',
format: 'esm',
},
})
Run the build:
npx rolldown -c rolldown.config.js
If you're migrating from Rollup, the configuration format is intentionally similar. Most Rollup configs work with minor adjustments — primarily around plugins that rely on Rollup internals rather than the documented plugin API.
Like what you're reading? Subscribe to DevTools Guide — free weekly guides in your inbox.
Plugin Compatibility
Rolldown implements the Rollup plugin interface, which means plugins using standard hooks (resolveId, load, transform, renderChunk) work out of the box. This covers the majority of the Rollup plugin ecosystem.
import { defineConfig } from 'rolldown'
import commonjs from '@rollup/plugin-commonjs'
export default defineConfig({
input: 'src/index.ts',
plugins: [commonjs()],
output: {
dir: 'dist',
format: 'esm',
},
})
Plugins that use undocumented Rollup internals or rely on specific bundling order may need updates. The Rolldown team maintains a compatibility tracker for popular plugins.
Built-in TypeScript and JSX
Unlike Rollup, which requires @rollup/plugin-typescript or @rollup/plugin-babel for TypeScript support, Rolldown handles TypeScript and JSX natively:
export default defineConfig({
input: 'src/index.tsx',
output: {
dir: 'dist',
format: 'esm',
},
// TypeScript and JSX work without any plugins
})
This isn't just convenient — it's faster. Native transforms avoid the JavaScript↔Rust serialization overhead that plugin-based approaches incur. For projects with hundreds of TypeScript files, this alone can cut build times significantly.
How It Fits with Vite
Rolldown's primary integration target is Vite. The Vite team is working toward using Rolldown as the single bundler for both development and production builds. This means:
- Dev server: Rolldown replaces esbuild for dependency pre-bundling and TypeScript/JSX transforms
- Production build: Rolldown replaces Rollup for the final bundle
- Consistent behavior: The same bundler runs in both environments, eliminating an entire class of "works in dev, breaks in prod" bugs
For Vite users, this transition will mostly be invisible — Vite's configuration API stays the same, and existing plugins continue working through the Rollup-compatible interface.
When to Use Rolldown
Good fit:
- Vite projects that want faster builds and consistent dev/prod behavior
- Projects currently using Rollup that need better performance
- Libraries that publish ESM bundles and want fast CI builds
- Monorepos where build time is a bottleneck
Not the best fit (yet):
- Projects deeply invested in webpack's ecosystem and loader system
- Applications requiring webpack-specific features like Module Federation
- Projects that need absolute stability — Rolldown is still maturing and the API may shift
Rolldown vs Rspack vs Turbopack
The Rust-based bundler space now has several contenders:
- Rspack focuses on webpack compatibility — it's the right choice if you're migrating from webpack and need the same plugin/loader ecosystem
- Turbopack is Vercel's bundler, tightly integrated with Next.js — great if you're in that ecosystem, less useful outside it
- Rolldown focuses on Rollup compatibility and Vite integration — it's the natural upgrade path for Rollup and Vite users
These tools solve different migration paths rather than competing directly. Pick based on your current toolchain, not raw benchmarks.
Practical Migration Tips
If you're moving from Rollup to Rolldown:
- Start with the config — copy your
rollup.config.jsand rename it. Most options map directly. - Test plugins one at a time — remove all plugins, verify the base build works, then add plugins back individually.
- Check output — compare the bundled output between Rollup and Rolldown. Tree shaking differences may surface edge cases in your code.
- Update CI — Rolldown's speed improvement means you can tighten CI timeout thresholds and potentially remove caching layers that existed only to work around slow builds.
What to Watch
Rolldown is under active development with frequent releases. The project is approaching production stability, but breaking changes still happen between minor versions. Pin your version in package.json and test upgrades explicitly rather than using loose version ranges.
The Vite integration is the milestone that will push Rolldown into mainstream adoption. When Vite ships with Rolldown as the default bundler, millions of projects will be using it whether they know it or not. Getting familiar with it now means fewer surprises when that transition happens.
