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:

ProjectBeforeAfterImprovement
Linear46s6s87% 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:
    1. Direct upgrade (recommended for most)
    2. Gradual migration via rolldown-vite package (for complex projects)

AST & Transformer Capabilities

Experimental Features

Two experimental optimizations are being developed:

  1. Raw AST Transfer

    • JavaScript plugins can access Rust-produced AST
    • Minimal overhead for JS plugin authors
    • Enables complex transformations without re-parsing
  2. 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

  1. Build-time focus: Vite’s plugin system is optimized for transforming existing code, not generating new files
  2. No full AST in dev: moduleParsed hook isn’t called during development (performance optimization)
  3. Type erasure: TypeScript types are erased during compilation, making interface information unavailable at transform time

Better Alternatives

For Build-Time Mock Generation

  1. ts-morph or TypeScript Compiler API

    • Parse TypeScript source files directly
    • Extract interface definitions
    • Generate mock implementations
    • Run as pre-build or separate script
  2. unplugin-ast

    • AST manipulation for Vite/esbuild/Rollup
    • Custom transformers for code modification
    • Works across build tools
  3. 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)

For mock generation from TypeScript interfaces:

// 1. Pre-build script using ts-morph
import { Project } from 'ts-morph';
const project = new Project();
const sourceFile = project.addSourceFileAtPath('src/types.ts');
// Extract interfaces and generate mocks
const interfaces = sourceFile.getInterfaces();
for (const iface of interfaces) {
generateMockFile(iface);
}
// 2. Or use runtime libraries in tests
import { 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

Terminal window
npm install vite@^8.0.0-beta

Gradual Migration

Terminal window
npm install rolldown-vite
# Use rolldown-vite as drop-in replacement while testing

Configuration Adjustments

Check for:

  • Rollup-specific options that need updating
  • esbuild-specific options that may no longer apply
  • Custom plugins that access internal APIs

Sources

  1. Vite 8 Beta Announcement
  2. Vite Plugin API
  3. unplugin-ast
  4. vite-plugin-typescript-transform
  5. Rolldown GitHub
  6. Oxc Project