npm create vite@latest Need to install the following packages: create-vite@4.1.0 Ok to proceed? (y) y ✔ Project name: … vitetest ? Select a framework: › - Use arrow-keys. Return to submit. Vanilla ❯ Vue React Preact Lit Svelte Others ? Select a variant: › - Use arrow-keys. Return to submit. JavaScript ❯ TypeScript Customize with create-vue ↗ Nuxt ↗
Scaffolding project in xx/vitetest...
Done. Now run:
cd vitetest npm install npm run dev
项目目录如下
配置文件为vite.config.ts
运行
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
cd xx/vitetest
// 安装依赖包 npm install
// 运行 npm run dev > vitetest@0.0.0 dev > vite
VITE v4.1.4 ready in 385 ms
➜ Local: http://localhost:5173/ ➜ Network: use --host to expose ➜ press h to show help
打包
1 2 3 4 5 6 7 8 9 10 11
npm run build
> vitetest@0.0.0 build > vue-tsc && vite build
vite v4.1.4 building for production... ✓ 18 modules transformed. dist/index.html 0.45 kB dist/assets/vue-5532db34.svg 0.50 kB dist/assets/index-08cab964.css 1.30 kB │ gzip: 0.67 kB dist/assets/index-316eef2e.js 54.50 kB │ gzip: 21.98 kB