vite.config.ts Builder

Generate a Vite configuration for React, Vue, or vanilla JS apps

Creates a vite.config.ts with framework plugin, resolve aliases, dev server proxy, build output options, and environment variable handling for React, Vue, Svelte, or vanilla JavaScript projects.

What plugin does each framework use?

React uses @vitejs/plugin-react, Vue uses @vitejs/plugin-vue, and Svelte uses @sveltejs/vite-plugin-svelte. Vanilla JavaScript needs no framework plugin at all, so Vite works out of the box.

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.