注意:
Vite 需要 Node.js 版本 >= 12.0.0。
使用 NPM:
npm init @vitejs/app
使用 Yarn:
yarn create @vitejs/app
然后按照提示操作即可!
你还可以通过附加的命令行选项直接指定项目名称和你想要使用的模板。例如,要构建一个 Vite + Vue 项目,运行:
# npm 6.x
npm init @vitejs/app my-vue-app --template vue
# npm 7+, 需要额外的双横线:
npm init @vitejs/app my-vue-app -- --template vue
# yarn
yarn create @vitejs/app my-vue-app --template vue
支持的模板预设包括:
- vanilla
- vue
- vue-ts
- react
- react-ts
- preact
- preact-ts
- lit-element
- lit-element-ts
创建好项目后
yarn install
yarn dev
先写这么多,后续继续更新