0
Vite · Configuration
New technique
vite.config.ts
Every forge has its own settings: how hot, which tools on the rack. Vite keeps them in one file.
Vite reads vite.config.ts (or .js) from the project root. It default-exports a config object. The file is optional: without it, Vite's defaults apply.
Wrap that object in defineConfig: it changes nothing at runtime, but gives you autocomplete and type checking for every option. A typo like plugin instead of plugins gets a red underline instead of being silently ignored.
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
});