vite 安装
F:\vue>npm init vite-app xueyuan // 创建项目 npx: installed 7 in 17.295s Scaffolding project in F:\vue\xueyuan... Done. Now run: cd xueyuan npm install (or `yarn`) // 安装依赖 npm run dev (or `yarn dev`) // 运行项目 F:\vue>cd xueyuan F:\vue\xueyuan>npm install > esbuild@0.8.57 postinstall F:\vue\xueyuan\node_modules\esbuild > node install.js npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules\chokidar\node_modules\ fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os": "darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN xueyuan@0.0.0 No description npm WARN xueyuan@0.0.0 No repository field. npm WARN xueyuan@0.0.0 No license field. added 286 packages from 276 contributors in 209.763s 33 packages are looking for funding run `npm fund` for details F:\vue\xueyuan>npm run dev > xueyuan@0.0.0 dev F:\vue\xueyuan > vite [vite] Optimizable dependencies detected: vue Dev server running at: > Network: http://192.168.43.72:3000/ > Local: http://localhost:3000
目录结构
node_modules 目录用来存放第三方依赖包
public 是公共的静态资源目录
src 是项目的源代码目录(程序员写的所有代码都要放在此目录下)
assets 目录用来存放项目中所有的静态资源文件(css、fonts等)
components 目录用来存放项目中所有的自定义组件
App.vue 是项目的根组件
index.css 是项目的全局样式表文件
main.js 是整个项目的打包入口文件
.gitignore 是 Git 的忽略文件
index.html 是单页面应用程序中唯一的 HTML 页面
package.json 是项目的包管理配置文件