LinuxCommandLibrary

vite

TLDR

Start the development server

$ vite
copy
Start dev server on a specific port
$ vite --port [3000]
copy
Build for production
$ vite build
copy
Preview production build locally
$ vite preview
copy
Use a specific config file
$ vite --config [vite.config.js]
copy
Build with a specific base path
$ vite build --base [/my/public/path/]
copy
Force dependency pre-bundling
$ vite --force
copy
Build in specific mode
$ vite build --mode [production]
copy

SYNOPSIS

vite [command] [options]

DESCRIPTION

Vite is a next-generation frontend build tool that provides an extremely fast development experience. It leverages native ES modules in the browser during development, eliminating the bundling step for faster hot module replacement (HMR).
For production, Vite bundles code using Rollup, producing optimized static assets. It supports TypeScript, JSX, CSS preprocessing, and various frameworks (Vue, React, Svelte) out of the box.
Configuration is typically stored in vite.config.js or vite.config.ts. Vite requires Node.js 20.19+ or 22.12+.

PARAMETERS

dev, serve

Start development server (default command).
build
Build for production.
preview
Locally preview production build.
optimize
Pre-bundle dependencies.
-c, --config file
Use specified config file.
--base path
Public base path for the build.
--mode mode
Set env mode (development, production).
--port port
Port number for dev server.
--host host
Hostname to listen on.
--open [path]
Open browser on server start.
--force
Force dependency pre-bundling.
--clearScreen
Clear terminal screen on start.
-l, --logLevel level
Log level: info, warn, error, silent.
-d, --debug [filter]
Enable debug mode with optional filter.
-h, --help
Display help message.
-v, --version
Display version.

CAVEATS

The preview server is not designed for production use; deploy the built files with a proper static file server. Some Node.js APIs are not available in the browser during development. Legacy browser support requires the @vitejs/plugin-legacy plugin.

HISTORY

Vite was created by Evan You (creator of Vue.js) and first released in April 2020. The name means "fast" in French. Vite 2.0, released in February 2021, was a major rewrite that made it framework-agnostic. It has rapidly gained adoption as an alternative to webpack, influencing the broader JavaScript tooling ecosystem.

SEE ALSO

npm(1), webpack(1), rollup(1), esbuild(1)

Copied to clipboard