Vite build tool configuration, plugin API, SSR, and Vite 8 Rolldown migration. Use when working with Vite projects, vite.config.ts, Vite plugins, or building libraries/SSR apps with Vite.
$npx -y skills add antfu/skills --skill viteInstalls into the current project.
Run `npx skills use "https://github.com/antfu/skills" --skill "antfu/skills/vite"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.
Use the skills in "https://github.com/antfu/skills" that are relevant to the current task. Run `npx skills add "https://github.com/antfu/skills"` and select the relevant skills, then follow their instructions.
| 1 | # Vite |
| 2 | |
| 3 | > Based on Vite 8 beta (Rolldown-powered). Vite 8 uses Rolldown bundler and Oxc transformer. |
| 4 | |
| 5 | Vite is a next-generation frontend build tool with fast dev server (native ESM + HMR) and optimized production builds. |
| 6 | |
| 7 | ## Preferences |
| 8 | |
| 9 | - Use TypeScript: prefer `vite.config.ts` |
| 10 | - Always use ESM, avoid CommonJS |
| 11 | |
| 12 | ## Core |
| 13 | |
| 14 | | Topic | Description | Reference | |
| 15 | |-------|-------------|-----------| |
| 16 | | Configuration | `vite.config.ts`, `defineConfig`, conditional configs, `loadEnv` | [core-config](references/core-config.md) | |
| 17 | | Features | `import.meta.glob`, asset queries (`?raw`, `?url`), `import.meta.env`, HMR API | [core-features](references/core-features.md) | |
| 18 | | Plugin API | Vite-specific hooks, virtual modules, plugin ordering | [core-plugin-api](references/core-plugin-api.md) | |
| 19 | |
| 20 | ## Build & SSR |
| 21 | |
| 22 | | Topic | Description | Reference | |
| 23 | |-------|-------------|-----------| |
| 24 | | Build & SSR | Library mode, SSR middleware mode, `ssrLoadModule`, JavaScript API | [build-and-ssr](references/build-and-ssr.md) | |
| 25 | |
| 26 | ## Advanced |
| 27 | |
| 28 | | Topic | Description | Reference | |
| 29 | |-------|-------------|-----------| |
| 30 | | Environment API | Vite 6+ multi-environment support, custom runtimes | [environment-api](references/environment-api.md) | |
| 31 | | Rolldown Migration | Vite 8 changes: Rolldown bundler, Oxc transformer, config migration | [rolldown-migration](references/rolldown-migration.md) | |
| 32 | |
| 33 | ## Quick Reference |
| 34 | |
| 35 | ### CLI Commands |
| 36 | |
| 37 | ```bash |
| 38 | vite # Start dev server |
| 39 | vite build # Production build |
| 40 | vite preview # Preview production build |
| 41 | vite build --ssr # SSR build |
| 42 | ``` |
| 43 | |
| 44 | ### Common Config |
| 45 | |
| 46 | ```ts |
| 47 | import { defineConfig } from 'vite' |
| 48 | |
| 49 | export default defineConfig({ |
| 50 | plugins: [], |
| 51 | resolve: { alias: { '@': '/src' } }, |
| 52 | server: { port: 3000, proxy: { '/api': 'http://localhost:8080' } }, |
| 53 | build: { target: 'esnext', outDir: 'dist' }, |
| 54 | }) |
| 55 | ``` |
| 56 | |
| 57 | ### Official Plugins |
| 58 | |
| 59 | - `@vitejs/plugin-vue` - Vue 3 SFC support |
| 60 | - `@vitejs/plugin-vue-jsx` - Vue 3 JSX |
| 61 | - `@vitejs/plugin-react` - React with Oxc/Babel |
| 62 | - `@vitejs/plugin-react-swc` - React with SWC |
| 63 | - `@vitejs/plugin-legacy` - Legacy browser support |