← 返回命令列表

Linux command

vite 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start the development server

vite

Start dev server on a specific port

vite --port [3000]

Build for production

vite build

Preview production build

vite preview

Use a specific config file

vite --config [vite.config.js]

Build with a specific base path

vite build --base [/my/public/path/]

Force dependency pre-bundling

vite --force

Build in specific mode

vite build --mode [production]

说明

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+.

参数

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.

FAQ

What is the vite command used for?

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+.

How do I run a basic vite example?

Run `vite` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does dev, serve do in vite?

Start development server (default command).