Vite 8 Core Config Reference
Vite 8 config should reflect the Rolldown/Oxc architecture rather than older Rollup/esbuild-era defaults.
Core CLI
vite devvite buildvite build --ssr <entry>vite preview
Config Loading
Vite 8 supports config loading modes such as bundle, runner, and native via --configLoader when debugging config execution behavior.
Preferred Config Surface
import { defineConfig } from 'vite';
export default defineConfig({
build: {
rolldownOptions: {
external: ['react'],
},
},
oxc: {
jsxInject: "import React from 'react'",
},
environments: {
ssr: {},
},
});Migration Notes
- Prefer
build.rolldownOptionsoverbuild.rollupOptions - Prefer
oxcoveresbuildin new Vite 8 guidance - Default build targeting follows the Baseline Widely Available browser target
- Lightning CSS is part of the modern Vite 8 direction for CSS processing/minification
- Node.js must satisfy the Vite 8 runtime floor (
20.19+or22.12+) build.commonjsOptionsis effectively a no-op in the Rolldown era and should not be treated as a first-line tuning lever
CommonJS Interop Note
Vite 8 tightened default-import behavior for CommonJS modules. When a CJS import suddenly behaves differently across older and newer examples, treat that as a real migration boundary rather than a random build bug.
Environment Configuration
Use environments when runtime behavior differs meaningfully between client, SSR, edge, or custom execution targets.