Vite needs a short config file to wire up your framework plugin, dev server, and
build output. This builder generates a clean, working vite.config.ts for the
framework you pick, so you can skip the boilerplate and start coding.
How it works
The config exports defineConfig({...}), which gives you full TypeScript
autocompletion for every option. The structure is the same across frameworks —
only the plugins array changes:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
server: { port: 5173, proxy: { "/api": "http://localhost:3000" } },
build: { outDir: "dist", sourcemap: true },
});
The resolve.alias map turns @ into an absolute path to your src folder
using path.resolve(__dirname, "./src"). The server.proxy block forwards a
path prefix such as /api to a backend origin during development, setting
changeOrigin: true so the upstream Host header is rewritten correctly.
Tips and notes
Install the matching plugin package after copying the config — for example
npm i -D @vitejs/plugin-react. If you enable the @ alias here, add the same
mapping to your tsconfig.json under compilerOptions.paths so your editor and
the type-checker resolve imports the same way Vite does at build time. Leave the
proxy target blank if your app has no separate backend.