Global Options
These options are available for all Vite commands (vite, vite build, vite preview, vite optimize).
Configuration
Use a specific configuration file instead of auto-resolving.Vite will automatically try to resolve a config file named
vite.config.js inside the project root. Use this option to specify a different config file.Public base path for the application. Must start and end with a slash.This is useful when deploying to a subdirectory or using a CDN.
Specify how to load the configuration file.
bundle- Bundle the config with Rolldown (default, most compatible)runner- Process the config on the fly (experimental)native- Load using the native runtime (experimental)
Logging
Set the verbosity level of console output.
info- Show all messages (default)warn- Only warnings and errorserror- Only errorssilent- No output
Allow or disable clearing the terminal screen when logging.
Debugging
Show debug logs. Can optionally filter by namespace.You can use glob patterns to filter debug logs:
Filter debug logs by pattern.
Environment
Set the environment mode. This determines which By default:
.env file is loaded.viteusesdevelopmentmodevite buildusesproductionmodevite previewusesproductionmode
Mode determines which
.env.[mode] file is loaded. See Env Variables for more details.Help & Version
Display available CLI options.
Display the Vite version number.
Dev Server Options
Options specific to thevite command (dev server).
Network
Specify which IP addresses the server should listen on.
- Not set: Listen on
localhostonly trueor no value: Listen on all addresses including LAN and public- Specific IP: Listen on that IP address
0.0.0.0: Listen on all addresses
Specify the port number for the dev server.
If the port is already in use, Vite will automatically try the next available port unless
--strictPort is specified.Exit if the specified port is already in use instead of trying the next available port.
Enable CORS for the dev server. Allows requests from any origin.
Browser
Automatically open the app in the browser on server start.
trueor no value: Open to the root path- String: Open to the specified path
Optimization
Force Vite to ignore the dependency optimization cache and re-bundle.Use this when you want to force a fresh dependency optimization, for example after installing new packages or changing optimization configuration.
Experimental
Enable experimental full bundle mode.
Build Options
Options specific to thevite build command.
Output
Output directory for the production build (relative to project root).
Directory (relative to
outDir) to place assets in.Force empty the output directory when it’s outside of the project root.By default, Vite will:
- Empty
outDirif it’s inside the project root - Warn and not empty if it’s outside the project root
Assets
Static asset base64 inline threshold in bytes.Assets smaller than this will be inlined as base64 strings. Set to
0 to disable inlining.Code Processing
Transpile target for the build output.Can be a specific browser version or one of the following:
baseline-widely-available- Widely available baseline (default)esnext- Latest ECMAScript features- Browser name and version (e.g.,
chrome90,safari13)
Enable/disable minification, or specify the minifier to use.
esbuild- Use esbuild (default, faster)terser- Use Terser (slower, better compression)false- Disable minification
Generate source maps for the build.
true- Generate separate.mapfilesinline- Inline source maps in the output fileshidden- Generate source maps but don’t add source map commentsfalse- Don’t generate source maps (default)
SSR
Build the specified entry point for server-side rendering.
Manifests
Emit a manifest file mapping non-hashed asset filenames to their hashed versions.The manifest is useful for backend integration to resolve hashed filenames.
true: Generatemanifest.jsoninoutDir- String: Custom filename or path for the manifest
Emit an SSR manifest for determining style links and asset preload directives.
Watch Mode
Enable watch mode. Rebuilds when source files change.
Experimental
Build all environments. Same as setting
builder: {} in the configuration.Preview Options
Options specific to thevite preview command.
Specify which IP addresses the preview server should listen on.
Specify the port number for the preview server.
Exit if the specified port is already in use.
Automatically open the app in the browser.
Specify the output directory to serve.
Optimize Options
Options specific to thevite optimize command (deprecated).
Force the optimizer to ignore the cache and re-bundle dependencies.
Environment Variables
You can pass additional arguments to Node.js using environment variables:Passing Arguments to Scripts
You can pass extra arguments to your build scripts using--:
process.argv.