API Reference
The core exports, config keys, and plugin hooks developers reach for most.
Third-party documentation. This is independently authored analysis of the public Vite codebase — not the official docs, and not reviewed or endorsed by the Vite team.
API Reference
The core runtime APIs, CLI commands, config keys, and plugin hooks that developers reach for most. This is a curated map of the public surface — for exhaustive detail, see the official documentation.
Runtime APIs
import.meta.env—MODE,BASE_URL,PROD,DEV,SSR, and everyVITE_-prefixed variable.import.meta.hot— the HMR client:accept,dispose,invalidate,send/on.import.meta.glob— import a set of modules statically or lazily from a glob pattern.import.meta.url— the current module's URL.
CLI
vite(aliasesdev,serve) — start the dev server.vite build— production build intodist/.vite preview— serve the production build locally.vite optimize— manually pre-bundle dependencies.
Key config keys
plugins, resolve.alias/resolve.extensions, server.host/port/proxy/fs.allow, build.outDir/target/sourcemap/rollupOptions.output.manualChunks, envPrefix, optimizeDeps.include/exclude, publicDir, and base.
Plugin hooks
Vite inherits Rollup's resolveId, load, transform, buildStart, and output hooks, and adds dev-only hooks: config/configResolved (mutate config), configureServer (dev middleware), transformIndexHtml (rewrite index.html), and handleHotUpdate (customize HMR).
Common packages
@vitejs/plugin-react (React Fast Refresh), @vitejs/plugin-vue (Vue SFC compilation and HMR), @vitejs/plugin-legacy (legacy browser support via SystemJS), and create-vite (scaffolding templates).
Interface
# Runtime APIsimport.meta.env { MODE, BASE_URL, PROD, DEV, SSR, VITE_* }import.meta.hot HMR client (accept, dispose, invalidate, send/on)import.meta.glob import many modules statically or lazilyimport.meta.url current module URL# CLIvite start dev server (aliases: dev, serve)vite build production buildvite preview preview the production buildvite optimize pre-bundle dependencies manually# Config (vite.config.ts, defineConfig)plugins, resolve.alias, resolve.extensionsserver.host, server.port, server.proxy, server.fs.allowbuild.outDir, build.target, build.sourcemap,build.rollupOptions.output.manualChunksenvPrefix, optimizeDeps.include/exclude, publicDir, base# Plugin API (extends Rollup hooks)config / configResolved mutate configconfigureServer dev-server middlewaretransformIndexHtml modify index.htmlresolveId / load / transform per-module pipeline (dev + build)handleHotUpdate customize HMRcloseBundle run after build finishes# Common plugins / packages@vitejs/plugin-react React Fast Refresh@vitejs/plugin-vue Vue SFC compiler + HMR@vitejs/plugin-legacy legacy browser buildscreate-vite scaffolding templates
