Vite 6: A Platform, Not Just a Bundler
Vite 6 is the release that completes Vite's evolution from a dev server into a full build platform. Two changes define this release: the Environment API for multi-target builds, and the experimental Rolldown integration that previews what Vite 7 will look like.
The Environment API
Before Vite 6, handling multiple build targets (client JS, SSR Node bundle, service worker) required separate Vite configs or complex plugins. The Environment API unifies them:
// vite.config.ts
import { defineConfig } from "vite";
export default defineConfig({
environments: {
client: {
// browser output
build: { outDir: "dist/client" },
},
ssr: {
// Node.js SSR bundle
resolve: { conditions: ["node"] },
build: { outDir: "dist/server", ssr: true },
},
worker: {
// Service worker / Cloudflare Worker
build: { outDir: "dist/worker", target: "webworker" },
},
},
});
Plugins can now inspect and transform assets for specific environments:
function myPlugin() {
return {
name: "env-aware",
resolveId(id, importer, options) {
if (options.environment.name === "worker") {
// different resolution for worker env
}
},
};
}
Rolldown: The Rust Bundler Experiment
Rolldown is a Rust-based Rollup replacement built by the Vite team. It is API-compatible with Rollup but dramatically faster:
| Benchmark | Rollup | Rolldown | Speedup | |-----------|--------|----------|---------| | Build three.js | 4.2s | 0.4s | 10.5x | | Build Lodash | 1.8s | 0.19s | 9.5x | | Production bundle | varies | ~10x | consistent |
Enable it experimentally in Vite 6:
// vite.config.ts
export default defineConfig({
experimental: {
rolldownVersion: true,
},
});
This is opt-in and may have edge cases. Rolldown is expected to become the default in Vite 7.
vite build --app
A new --app flag for framework-agnostic HTML-first builds — no framework adapter needed for simple multi-page apps:
vite build --app
This discovers all HTML entry points automatically and builds them together with shared chunk splitting.
CSS Source Maps Improvements
Vite 6 generates accurate CSS source maps for PostCSS transforms and CSS modules. Previously, source maps for CSS would point to intermediate files — now they trace back to the original source line.
export default defineConfig({
css: {
devSourcemap: true, // accurate in v6
},
});
Deprecation: CJS Node API
Vite 6 deprecates the CommonJS Node.js API (require("vite")). The ESM API is now the only supported interface. Update your config if you use createServer or build programmatically:
// Before (CJS)
const { createServer } = require("vite");
// After (ESM)
import { createServer } from "vite";
Migrating From Vite 5
pnpm add -D vite@6
Breaking changes to check:
- Node.js minimum is now 18.0.0
definevalues are no longer stringified by default for non-string primitives — useJSON.stringifyexplicitly- Some plugin hook signatures changed for the Environment API — check your plugins against the migration guide
optimizeDeps.forceremoved — use--forceCLI flag
References: Vite 6 blog · Rolldown · migration guide