Vite 备忘单

Vite构建工具配置和命令的快速参考。

$npm create vite@latest
Create a new Vite project
$vite
Start dev server
$vite build
Build for production
$vite preview
Preview production build locally
$vite optimize
Pre-bundle dependencies
$import.meta.env.MODE
Current mode (development/production)
$import.meta.env.VITE_*
Access env variables with VITE_ prefix
$import.meta.glob()
Glob import pattern
$resolve.alias
Configure path aliases in vite.config
$server.proxy
Configure dev server proxy