Vite uses esbuild for lightning-fast development tasks (pre-bundling, transpilation, minification) and Rollup for optimized production builds (chunking, plugin ecosystem), combining their strengths until Vite 8 unifies them with Rolldown
Vite strategically employs two different bundlers to optimize for the distinct requirements of development and production environments. This dual-bundler approach leverages the unique strengths of each tool where they excel best. esbuild, written in Go, provides unmatched speed for development-time operations like dependency pre-bundling and on-the-fly transpilation . Rollup, a mature JavaScript bundler, offers sophisticated chunk splitting, tree-shaking, and a rich plugin ecosystem essential for production optimization . The trade-off has been necessary because neither tool alone could optimally serve both development and production needs—until the introduction of Rolldown in Vite 8 .
The fundamental reason Vite uses both esbuild and Rollup lies in their complementary strengths and weaknesses. esbuild is blazingly fast and feature-rich, but its output, particularly regarding chunk splitting limitations, is not ideal for bundling applications . Rollup is mature and battle-tested for application bundling but is significantly slower than tools written in compile-to-native languages . Having to use two different bundlers creates suboptimal outcomes: subtle differences between development and production outputs can cause behavior inconsistencies, and user source code must be repeatedly parsed, transformed, and serialized by different tools throughout the production build, leading to avoidable overhead .
Dependency Pre-bundling: When you first run vite, it pre-bundles project dependencies using esbuild. This serves two purposes: converting CommonJS or UMD dependencies to ESM for native browser compatibility, and bundling dependencies with many internal modules (like lodash-es with 600+ files) into single modules to reduce HTTP requests . This process happens automatically and is exceptionally fast because esbuild is written in Go .
TypeScript/JSX Transpilation: During development, esbuild handles converting TypeScript, JSX, and TSX files to JavaScript on-the-fly. It's Vite's default transpiler for these operations .
Minification: For production builds, esbuild performs minification by default (20-40x faster than Terser) . You can configure this with build.minify: 'esbuild' (the default) or switch to terser if needed .
Define replacements: esbuild handles constant replacements during both development and build processes .
Target lowering: esbuild transforms code to match specified browser targets through the build.target configuration .
Rollup is exclusively used during the production build phase (vite build). Vite internally calls Rollup to handle module bundling, applying the configuration from vite.config.js (especially build.rollupOptions) to control the bundling process . Rollup's strengths that Vite leverages include sophisticated chunk splitting for optimal code organization, advanced tree-shaking to eliminate dead code, scope hoisting for improved runtime performance, and a mature plugin ecosystem that Vite can utilize during builds . The configuration sharing between Vite and Rollup means developers can directly influence Rollup's behavior through Vite's configuration file .
The dual-bundler architecture, while effective, introduced inconsistencies and overhead. To solve this, the Vite team built Rolldown, a next-generation bundler written in Rust . Vite 8 beta replaces the esbuild+Rollup combination with Rolldown as its single bundler. Rolldown matches esbuild's native-level performance (10-30× faster than Rollup) while maintaining Rollup-compatible APIs and plugin interfaces . Early adopters have seen dramatic improvements: Linear's production build times dropped from 46 seconds to 6 seconds, Ramp reduced build time by 57%, and Mercedes-Benz.io cut build time by up to 38% . This unification eliminates behavior differences between development and production, reduces redundant code processing, and enables advanced features like module-level persistent caching and Module Federation .
Development: Vite primarily uses esbuild for pre-bundling, transpilation, and fast server startup .
Production: Vite uses Rollup for optimized bundling with advanced chunking and tree-shaking .
Vite 8+: Rolldown unifies both roles, providing native speed with Rollup compatibility .