vite-8-rolldown
Overview
Vite 8 Beta (announced December 2025) represents a fundamental architectural shift in the Vite ecosystem. The dual-bundler approach (esbuild for development, Rollup for production) is being replaced by Rolldown, a Rust-based bundler that unifies both phases.
Key Significance
Unified Toolchain
Vite 8 creates an end-to-end toolchain maintained by the same team:
Vite (build tool) → Rolldown (bundler) → Oxc (compiler)This unification brings:
- Consistent behavior between dev and production
- Single dependency instead of esbuild + Rollup
- Coordinated development across the stack
Performance Gains
Rolldown is 10–30× faster than Rollup:
| Project | Before | After | Improvement |
|---|---|---|---|
| Linear | 46s | 6s | 87% faster |
| Beehiiv | - | - | 64% reduction |
Upcoming Full Bundle Mode promises:
- 3× faster dev server startup
- 40% faster full reloads
Breaking Changes
- Projects using specific Rollup or esbuild options need configuration adjustments
- Migration guide is mandatory reading
- Two upgrade paths:
- Direct upgrade (recommended for most)
- Gradual migration via
rolldown-vitepackage (for complex projects)
AST & Transformer Capabilities
Experimental Features
Two experimental optimizations are being developed:
-
Raw AST Transfer
- JavaScript plugins can access Rust-produced AST
- Minimal overhead for JS plugin authors
- Enables complex transformations without re-parsing
-
Native MagicString Transforms
- Custom transforms with JavaScript logic
- Computation handled in Rust
- Best of both worlds: flexibility + speed
Plugin Compatibility
Most Vite plugins work out of the box with Vite 8.
The plugin API is preserved, making migration smooth for the ecosystem.
Can Vite Generate TypeScript Mocks from Interfaces?
Short answer: No, Vite isn’t the right tool for this.
Why Vite Isn’t Suitable
- Build-time focus: Vite’s plugin system is optimized for transforming existing code, not generating new files
- No full AST in dev:
moduleParsedhook isn’t called during development (performance optimization) - Type erasure: TypeScript types are erased during compilation, making interface information unavailable at transform time
Better Alternatives
For Build-Time Mock Generation
-
ts-morph or TypeScript Compiler API
- Parse TypeScript source files directly
- Extract interface definitions
- Generate mock implementations
- Run as pre-build or separate script
-
- AST manipulation for Vite/esbuild/Rollup
- Custom transformers for code modification
- Works across build tools
-
vite-plugin-typescript-transform
- Applies TS compiler during Vite’s transform phase
- Enables custom TypeScript transformers
- Useful for decorator support
For Runtime Mock Generation
Libraries that leverage TypeScript’s type system at test time:
- jest-mock-extended - Type-safe mocking for Jest
- bun-mock-extended - Type-safe mocking for Bun
- ts-auto-mock - Automatic mock generation from interfaces (requires ttypescript)
Recommended Pattern
For mock generation from TypeScript interfaces:
// 1. Pre-build script using ts-morphimport { Project } from 'ts-morph';
const project = new Project();const sourceFile = project.addSourceFileAtPath('src/types.ts');
// Extract interfaces and generate mocksconst interfaces = sourceFile.getInterfaces();for (const iface of interfaces) { generateMockFile(iface);}// 2. Or use runtime libraries in testsimport { mock } from 'jest-mock-extended';import type { UserService } from './services';
const mockUserService = mock<UserService>();mockUserService.getUser.mockReturnValue({ id: 1, name: 'Test' });Migration Guide
Direct Upgrade
npm install vite@^8.0.0-betaGradual Migration
npm install rolldown-vite# Use rolldown-vite as drop-in replacement while testingConfiguration Adjustments
Check for:
- Rollup-specific options that need updating
- esbuild-specific options that may no longer apply
- Custom plugins that access internal APIs