Vite
Use this skill when work touches Vite: scaffolding, vite.config, plugins, env/modes, dep optimization, production builds, SSR/backend integration, library mode, or upgrading to Vite 8 (Rolldown/Oxc).
Workflow
- Inspect the local Vite surface:
- Package version (
vite@8.x preferred; snapshot 8.2.0). Node: ^20.19.0 || >=22.12.0.
- Config:
vite.config.ts / .js, defineConfig, plugins, appType.
- Defaults in use: Rolldown build + Oxc transform/minify + Lightning CSS minify (Vite 8) vs older esbuild/Rollup (Vite 7-).
- Scripts:
vite / vite build / vite preview; framework plugins (@vitejs/plugin-*).
- For day-to-day how-to, follow usage-guide.md first.
- Refresh docs when versions drift or the task is migration/SSR/Environment API. Start from source-map.md.
- Route deeper detail:
- Config, CLI, env, assets, CSS, HMR: config-cli-env.md.
- Plugins, build, lib mode, MPA, performance: plugins-build.md.
- SSR, backend integration, proxy, middleware: ssr-backend.md.
- Vite 7→8 / Rolldown: migration-v8.md.
- Prefer Vite 8 APIs (
build.rolldownOptions, oxc, optimizeDeps.rolldownOptions). Treat Environment API as RC, Full Bundle Mode / Lightning CSS as full transformer as experimental.
- Verify with
bunx vite build (or project scripts), vite preview, and separate tsc --noEmit when types matter.
Core Judgment
- Vite = dev server (native ESM + HMR) + production bundler. Vite 8 bundler/optimizer defaults are Rolldown; JS transform/minify Oxc; CSS minify Lightning CSS.
- Prefer
bunx vite / bun create vite in command examples; keep narrative npm registry references when describing packages.
index.html is the app entry (not under public/). public/ is copy-as-is static files.
- Vite does not typecheck — run
tsc --noEmit (or project typecheck) separately.
- Client env: only
envPrefix (default VITE_) reaches import.meta.env. Never put secrets in VITE_*.
- Config files do not auto-load
.env — use loadEnv inside defineConfig.
- Prefer
build.rolldownOptions over deprecated build.rollupOptions; prefer oxc over deprecated esbuild config.
- Chunk splitting: object
manualChunks removed; function form deprecated → Rolldown output.codeSplitting.
vite preview is not a production server — use it only to smoke dist.
- Dep cache:
node_modules/.vite; force with vite --force (do not rely on deprecated vite optimize).
- Official plugins live under
@vitejs/*. PWA (vite-plugin-pwa) is community.
- SSR/backend: enforce real security/auth on the host server; Vite middleware is a tooling layer.
Verification
Prefer repository-owned commands. For meaningful Vite work, cover the relevant subset:
bunx vite --version (or project vite) and confirm major (7 vs 8).
- Dev smoke:
bun run dev / HMR for the changed module.
bun run build then bun run preview (or equivalent).
- Typecheck separately when TS/paths/
import type matter.
- After config migration: confirm no remaining
manualChunks object form; Rolldown options resolve via configResolved if debugging.
- SSR: client + server builds; middleware mode smoke;
import.meta.env.SSR branches.
- Backend integration: manifest entries render correct CSS/JS URLs.
Report which checks ran, which did not, and any Vite version assumptions that remain.
1---2name: vite3description: Build, review, debug, configure, migrate, teach, or plan Vite frontend tooling with current docs and a full usage guide. Use for vite, create-vite, vite.config, defineConfig, loadEnv, import.meta.env, HMR, optimizeDeps, build.rolldownOptions, oxc, Lightning CSS, plugins (@vitejs/plugin-react, plugin-vue, plugin-legacy), SSR middlewareMode, ssrLoadModule, library mode, backend integration, multi-page apps, Environment API, and Vite 7 to Vite 8 / Rolldown migration.4---56# Vite78Use this skill when work touches Vite: scaffolding, `vite.config`, plugins, env/modes, dep optimization, production builds, SSR/backend integration, library mode, or upgrading to Vite 8 (Rolldown/Oxc).910## Workflow11121. Inspect the local Vite surface:13 - Package version (`vite@8.x` preferred; snapshot **8.2.0**). Node: `^20.19.0 || >=22.12.0`.14 - Config: `vite.config.ts` / `.js`, `defineConfig`, plugins, `appType`.15 - Defaults in use: Rolldown build + Oxc transform/minify + Lightning CSS minify (Vite 8) vs older esbuild/Rollup (Vite 7-).16 - Scripts: `vite` / `vite build` / `vite preview`; framework plugins (`@vitejs/plugin-*`).172. For day-to-day how-to, follow [usage-guide.md](references/usage-guide.md) first.183. Refresh docs when versions drift or the task is migration/SSR/Environment API. Start from [source-map.md](references/source-map.md).194. Route deeper detail:20 - Config, CLI, env, assets, CSS, HMR: [config-cli-env.md](references/config-cli-env.md).21 - Plugins, build, lib mode, MPA, performance: [plugins-build.md](references/plugins-build.md).22 - SSR, backend integration, proxy, middleware: [ssr-backend.md](references/ssr-backend.md).23 - Vite 7→8 / Rolldown: [migration-v8.md](references/migration-v8.md).245. Prefer Vite 8 APIs (`build.rolldownOptions`, `oxc`, `optimizeDeps.rolldownOptions`). Treat Environment API as **RC**, Full Bundle Mode / Lightning CSS as full transformer as **experimental**.256. Verify with `bunx vite build` (or project scripts), `vite preview`, and separate `tsc --noEmit` when types matter.2627## Core Judgment2829- Vite = **dev server (native ESM + HMR)** + **production bundler**. Vite 8 bundler/optimizer defaults are **Rolldown**; JS transform/minify **Oxc**; CSS minify **Lightning CSS**.30- Prefer **`bunx vite`** / **`bun create vite`** in command examples; keep narrative npm registry references when describing packages.31- `index.html` is the app entry (not under `public/`). `public/` is copy-as-is static files.32- Vite **does not typecheck** — run `tsc --noEmit` (or project typecheck) separately.33- Client env: only `envPrefix` (default **`VITE_`**) reaches `import.meta.env`. Never put secrets in `VITE_*`.34- Config files do **not** auto-load `.env` — use `loadEnv` inside `defineConfig`.35- Prefer `build.rolldownOptions` over deprecated `build.rollupOptions`; prefer `oxc` over deprecated `esbuild` config.36- Chunk splitting: object `manualChunks` **removed**; function form **deprecated** → Rolldown **`output.codeSplitting`**.37- `vite preview` is **not** a production server — use it only to smoke `dist`.38- Dep cache: `node_modules/.vite`; force with `vite --force` (do not rely on deprecated `vite optimize`).39- Official plugins live under `@vitejs/*`. PWA (`vite-plugin-pwa`) is community.40- SSR/backend: enforce real security/auth on the host server; Vite middleware is a tooling layer.4142## Verification4344Prefer repository-owned commands. For meaningful Vite work, cover the relevant subset:4546- `bunx vite --version` (or project `vite`) and confirm major (7 vs 8).47- Dev smoke: `bun run dev` / HMR for the changed module.48- `bun run build` then `bun run preview` (or equivalent).49- Typecheck separately when TS/paths/`import type` matter.50- After config migration: confirm no remaining `manualChunks` object form; Rolldown options resolve via `configResolved` if debugging.51- SSR: client + server builds; middleware mode smoke; `import.meta.env.SSR` branches.52- Backend integration: manifest entries render correct CSS/JS URLs.5354Report which checks ran, which did not, and any Vite version assumptions that remain.