What is Vite?
Frontend build tool by Evan You. Native ESM dev server (instant startup) + Rollup-based prod builds. Replaces webpack for most modern projects.
What is Vite?
Vite (pronounced "veet", French for "quick") is a modern frontend build tool created by Evan You (also creator of Vue.js). It dramatically speeds up the development feedback loop by serving source files as native ES modules during development and using Rollup to produce optimized bundles for production. Released in 2020 and stable since Vite 2.0 (2021), Vite has become the default build tool for Vue 3, SvelteKit, and Astro, and is increasingly chosen for React projects over Create React App (which is deprecated).
The pitch is simple: cold dev server starts in under a second, even for large projects, and hot module reload (HMR) updates feel instant regardless of project size. The reason: Vite ships your source code to the browser as native ES modules during development, letting the browser do the heavy lifting of dependency resolution. No bundling step on every change.
The two-mode architecture
Vite operates differently in dev vs. production:
Development mode: native ESM
The dev server serves your source files directly to the browser as native ES modules. The browser requests App.vue, Vite transforms it on-the-fly (compiling Vue/JSX/TypeScript), and returns it. Imports are resolved by the browser. No bundle is built upfront.
The killer optimization: only files the browser actually requests get processed. If you never visit /admin, none of those files compile. This is why even 10,000-file projects start instantly.
Dependencies (node_modules) get pre-bundled with esbuild (Go-based, ~10-100x faster than JavaScript bundlers) into a single ESM file each, so the browser doesn't make 100+ requests for one library.
Production mode: Rollup bundling
For production, Vite uses Rollup to produce optimized bundles. Code splitting, tree shaking, asset hashing, CSS extraction — all the standard production-build features. Output is a static dist/ directory ready to upload to any CDN or static host.
Why Vite is faster than webpack
| Phase | webpack | Vite |
|---|---|---|
| Dev cold start | 10-60s (full bundle) | 0.3-2s (no bundle) |
| HMR after edit | 1-5s (re-bundle affected) | 50-200ms (single file transform) |
| Dependency parsing | JS-based | esbuild (Go-based) |
| Initial scope | Whole project | Only requested routes |
The pattern is consistent: webpack does too much work upfront; Vite defers work until needed.
What works out of the box
- TypeScript (with
esbuildfor transpilation; type-checking is separate viatsc --noEmit). - JSX/TSX.
- CSS, CSS modules, Sass, Less, Stylus.
- PostCSS auto-detected from
postcss.config.js. - Static assets (
.png,.svg,.json) imported directly. - Environment variables via
.envfiles (withVITE_prefix exposed to client code for safety). - HMR for Vue, React, Svelte, vanilla JS.
- Glob imports (
import.meta.glob). - Web Worker imports (
new Worker(new URL(...))).
The plugin ecosystem
Vite plugins use a Rollup-compatible plugin API extended with Vite-specific hooks. Key plugins:
- @vitejs/plugin-vue, @vitejs/plugin-react — official framework support.
- @vitejs/plugin-legacy — generates a legacy bundle for older browsers (no native ESM).
- vite-plugin-pwa — service worker generation, manifest, offline support.
- unplugin-auto-import / unplugin-vue-components — auto-imports for common functions and components (huge DX win).
- vite-plugin-checker — runs TypeScript and ESLint in parallel during dev.
- vite-imagetools — image optimization at build time.
Common Vite gotchas
- Process.env doesn't work. Vite uses
import.meta.envinstead, withVITE_prefix. Migrating from CRA requires updating all env-var references. - Dynamic imports need full paths.
import(`./pages/${name}.tsx`)doesn't work like in webpack. Useimport.meta.globfor dynamic patterns. - SSR setup is more manual. Vite has SSR support but the framework integration is up to you. Use Nuxt (Vue), SvelteKit (Svelte), Astro, or Remix for SSR-out-of-the-box.
- esbuild doesn't type-check. Type errors won't break your dev server. Run
tsc --noEmitin CI or use vite-plugin-checker. - Some webpack plugins don't have Vite equivalents. Niche cases (specific module federation features, unusual asset handling) may require workarounds.
- HMR can break with global state. If your code mutates module-level globals, HMR may produce stale state. Either avoid the pattern or accept full reload for those modules.
Vite vs. esbuild vs. Turbopack vs. webpack
- Vite — dev server (native ESM) + Rollup-based prod build. Best for most modern frontend projects.
- esbuild — pure bundler (no dev server). Used by Vite under the hood for dependency pre-bundling. Use directly for libraries or scripts, not full apps.
- Turbopack — Next.js's experimental successor to webpack, written in Rust. Faster than webpack but tied to Next.js. Less mature than Vite.
- webpack — the granddaddy. Most flexible plugin ecosystem, but slow for modern projects. Still fine for legacy or apps with unusual webpack-specific requirements.
VoidZero and Vite's commercial future
Evan You started VoidZero in 2024 to commercialize and accelerate the entire Vite ecosystem (Vite, Vitest, Rolldown, Oxc). The company aims to provide enterprise tooling and consulting around Vite while keeping the core open source. This signals long-term sustainability for Vite — it's no longer a side project of Vue's creator.
FAQ: Vite
Should I migrate from webpack to Vite?
For most projects, yes — the dev experience improvement is dramatic. The migration cost depends on your webpack-specific config. Standard React/Vue/Svelte apps migrate in 1-3 days. Apps with custom webpack plugins, module federation, or heavy CommonJS interop may take 1-3 weeks.
Is Vite production-ready?
Yes, very. Vite has been stable since 2.0 (2021). Major adopters include Shopify, GitLab, Cypress, Storybook, Replit. Production bundles (via Rollup) are battle-tested.
Does Vite work with React?
Yes. Use @vitejs/plugin-react for standard React or @vitejs/plugin-react-swc for SWC-based fast refresh. Most teams migrating from Create React App pick Vite.
Can Vite do server-side rendering?
Yes — Vite has SSR APIs. But integrating them is involved; for most teams, use a meta-framework that wraps Vite (Nuxt, SvelteKit, Astro, Remix, Solid Start).
What's Rolldown?
Rolldown is the Rust-based replacement for Rollup that VoidZero is building. It will be drop-in compatible with Rollup's plugin API but much faster. When stable, Vite will use Rolldown for production builds, eliminating the dev/prod tooling discrepancy (esbuild for dev, Rollup for prod).
How is Vite different from Vitest?
Vitest is the unit-test runner that uses Vite's pipeline (so tests share the same transforms and config as your app). Created by the same team. Drop-in replacement for Jest in Vite projects.
How LoadFocus relates to Vite-built apps
Apps built with Vite still need their bundle sizes and runtime performance validated. The same JavaScript that loads quickly thanks to Rollup tree-shaking still needs to render quickly on slow devices. LoadFocus website speed testing validates Core Web Vitals on real network conditions across 30+ locations. API monitoring covers the backend endpoints your Vite-built SPA calls — bundle optimization doesn't help if the API is slow.
Related LoadFocus Tools
Put this concept into practice with LoadFocus — the same platform that powers everything you just read about.