官方脚手架安装命令
$ npm init vue@latest
Need to install the following packages:
create-vue@latest
Ok to proceed? (y)
Vue.js - The Progressive JavaScript Framework
? Project name: > vue-project
? Add TypeScript? > No / Yes
? Add JSX Support? > No / Yes
? Add Vue Router for Single Page Application development? > No / Yes
? Add Pinia for state management? No / Yes
? Add Vitest for Unit Testing? No / Yes
? Add Cypress for End-to-End testing? > No / Yes
? Add ESLint for code quality? > No / Yes
? Add Prettier for code formatting? > No / Yes
Scaffolding project in /path/to/vue-project...
Done. Now run:
cd vue-project
npm install
npm run lint
npm run dev
好的脚手架让用户通过选择,组装成适合自己的技术栈。整个过程十分丝滑。
上述指令调用的 create-vue
,会基于 vite 创建新项目。300 毫秒就可以启动开发服务器。
编辑器使用 VSCode 和 Volar 扩展,提升编码效率。