vite
Vite 5+Quick reference for Vite CLI commands: dev server, build, preview, dependency pre-bundling, plugin management, environment variables, and project inspection — with common options and practical examples.
30 commands
Dev server
viteStart the dev server using `vite.config.*` from the project root. Binds to `http://localhost:5173` by default; auto-detects framework preset.
--port <N>; --host <0.0.0.0|...> expose on network; --open open browser; --strict enforce port; --force re-prebundle deps
vite --port 4000 --hostvite --port <N>Bind the dev server to a specific port (the next free port is used if busy unless `--strict` is also passed).
vite --port 4000 --strictvite --hostExpose the dev server on every network interface (default is `localhost`). Combined with `--port` for a stable LAN URL.
vite --host 0.0.0.0 --port 5173vite --openOpen the default browser to the dev server URL once it's ready.
--open /path/to/route open to a specific route
vite --open /adminvite --forceForce re-running dependency pre-bundling (esbuild) on the next request. Use when adding a new dep or after a `.vite` cache corruption.
vite --forceBuild
vite buildProduce a production bundle into `dist/` by default. Uses Rollup; supports code-splitting, tree-shaking, CSS extraction, source maps, and asset hashing.
--mode development|production; --target es2020|...; --sourcemap; --minify esbuild|terser; --outDir dist
vite buildvite build --watchProduction build that re-runs whenever a watched source file changes. Rarely needed; mainly for embedding Vite inside another build pipeline.
vite build --watchvite build --mode <name>Pick a mode that drives `globalThis._importMeta_.env.MODE` and `.env.<mode>` overrides (`.env.development`, `.env.staging`).
vite build --mode staging && vite build --mode productionvite build --sourcemapEmit external `.map` files (default is hidden in production). Pair with deploy Sentry / LogRocket for stack traces.
vite build --sourcemapPreview
vite previewServe the freshly-built `dist/` over a local static server so you can sanity-check the production bundle before deploying.
--port <N>; --host; --strict; --outDir dist
vite preview --port 4173 --strictOptimize deps
vite optimizeDepsManual trigger of dependency pre-bundling without starting the dev server. Useful in CI to pre-populate `node_modules/.vite/deps`.
--force; --config <file>
vite optimizeDeps --forcevite optimizeDeps include <pkg>Force pre-bundling of a CommonJS dep that's not detected automatically. Edit `optimizeDeps.include` in `vite.config.ts` instead of using CLI.
vite optimizeDepsDiagnostics
vite --versionPrint Vite's version.
vite --versionvite infoPrint environment details (Node version, OS, package manager, Vite version, key plugin versions) — paste this into bug reports.
vite infovite --debugEnable verbose internal logging. Pipe to a file when chasing plugin / HMR issues.
vite --debug > vite-debug.log 2>&1Configuration
vite --config <file>Point Vite at a custom config file (CI often uses `vite.config.ci.ts` with extra plugins).
vite --config vite.config.ci.ts buildvite --configLoader <runner>Vite 6+ — choose how to load the config (`bundle` is the default since Vite 6; `runner` / `native` / `transform` are alternates for non-Node environments).
vite --configLoader runner buildPlugin CLI
vite plugin <name>Stub commands registered by some Vite plugins (e.g. `vite-plugin-pwa`'s `vite pwa-asset-generate`). Pass through.
vite pwa-asset-generateCustomization
vite --base <path>Set the public path for production assets (default `/`). Use `/my-site/` when serving from a sub-path behind a reverse proxy.
vite build --base /gurutoolkit/vite --logLevel <level>Control how much Vite logs: `info` (default) / `warn` / `error` / `silent`.
vite build --logLevel warnvite --clearScreen falseDon't clear the terminal between reloads — useful when piping Vite output to another tool (tmux / logs).
vite --clearScreen false | tee vite.logBuild targets
vite build --target <browserslist>Tell Rollup the minimum browser targets. Vite handles syntax down-leveling per esbuild config; legacy targets emit larger bundles.
vite build --target es2020,edge88,firefox78,chrome87,safari14vite build --cssCodeSplitEmit CSS as separate chunks per route (default true since Vite 4). Pass `--cssCodeSplit=false` to inline everything into one file.
vite build --cssCodeSplit=falsevite build --minify <esbuild|terser>Choose the minifier. esbuild is the fast default; `terser` produces slightly smaller output for legacy browsers.
vite build --minify terserCache
vite --forceDrop `node_modules/.vite/deps` and re-bundle — fix for stale pre-bundled deps after a major upgrade.
rm -rf node_modules/.vite && vite --forcerm -rf node_modules/.viteManually wipe the Vite cache. Same effect as `vite --force` on next dev start.
rm -rf node_modules/.vite && viteMisc
vite --helpList every CLI flag with a one-line description.
vite --helpvite create <name>Scaffold a Vite project (the old `create-vite` binary). Modern usage is `npm create vite@latest` (which routes through `npx`).
--template vue | react | svelte | lit | vanilla | etc.
npm create vite@latest my-app -- --template vue-tsnpx vite-node <script.ts>Run a TypeScript script in the same environment Vite uses for SSR — full module resolution, aliases, and env variables.
--options.transformMode ssr | web
npx vite-node scripts/seed.tsvite --cjsForce Vite to load its config as a CommonJS file (legacy projects). Use only when migrating from a CJS-only stack.
vite --cjs buildRelated command cheatsheets
volta
Quick reference for everyday Volta commands: install Node / npm / Yarn / pnpm toolchains, pin per-project versions, manage global packages, and troubleshoot Volta itself — with common options and practical examples.
25 commands
Volta 1.x
npm
Quick reference for everyday npm CLI commands: init / install / add / remove / update / scripts / run / publish / audit, plus lockfile, registry, and cache management — with common options and practical examples.
34 commands
npm 10+
yarn
Quick reference for everyday Yarn CLI commands (both Yarn Classic 1.x and Yarn Berry 2/3/4): install / add / remove / run / workspaces, lockfile, Plug'n'Play, and Berry configuration — with common options and practical examples.
33 commands
Yarn 1.x (classic) / Yarn 4 (berry)
pnpm
Quick reference for pnpm: install / add / remove / update, scripts, workspaces, store & cache and config — focused on the GitHub-site pnpm repo workflow, with options and practical examples.
31 commands
pnpm 9+
npx
Quick reference for npx commands: run one-off package binaries, scaffold projects, manage the npx cache, pin versions, and avoid pitfalls with interactive CLIs — with common options and practical examples.
25 commands
npx 10+ (shipped with npm)
Trademark & Use Notice
These command-line tool cheatsheets are open community references. The names, logos, and trademarks of the tools referenced here (such as Git™, Docker™, Kubernetes®, kubectl, PostgreSQL®, MySQL®, Redis™, MongoDB®, Linux™, PowerShell™, Vim™, and others) are the property of their respective owners and are used here solely for identification and reference purposes.
All content in these cheatsheets is independently authored as a simplified, self-contained reference. It is not affiliated with, endorsed by, or sourced from any official documentation. Command listings, flag descriptions, and examples are original simplifications; for authoritative information please consult the official documentation of each tool.
Command syntax and option flags may differ across tool versions. The version tags shown reflect stable releases; behavior may differ in other versions. This cheatsheet does not imply any preference or recommendation by the trademark holders.
If a trademark or copyright owner believes that any content on this site infringes their rights, please send an email to [email protected]. Upon receiving valid proof of rights, we will modify or remove the relevant content within a reasonable period.
This website assumes no legal liability for any direct or indirect losses arising from the use of information presented on these pages.
About Vite
Vite (French for "fast") is a next-generation frontend build tool authored by Evan You (the creator of Vue.js) and maintained by the Vite team, with the 1.0 release in April 2021 and the current stable line at Vite 5 / 6. Vite serves source code over native ESM during development — esbuild pre-bundles dependencies and Rollup-based HMR handles source updates in milliseconds — then bundles for production with Rollup. Compared to webpack, Vite skips the bundling step during dev so cold-start times drop from seconds to <300 ms even on large projects. Vite is framework-agnostic: official templates exist for Vue, React, Svelte, Preact, Lit, Solid, Qwik, and vanilla TS; community plugins cover Astro, Nuxt, SvelteKit, Remix, and more. Configuration lives in `vite.config.ts` (or `.js`/`.mjs`) and uses the Rollup-compatible plugin API plus a curated set of Vite-specific hooks. Vite never uploads your code anywhere — all dev/build runs locally. Production bundles ship as static assets that you deploy anywhere (Vercel, Netlify, nginx, S3).
Cheatsheet version 1.0.0