CLI3 与别于2
- 3是基于 webpack 4 打造,2是基于webpack 3
- 3 的设计原则:0 配置。移除配置文件根目录下的build,congfig等目录
- 3 提供了 vue ui 命令,提供了可视化配置
- 移除了 static 文件夹,新增了 public 文件夹,并且 index.html 移动到 public 中
创建项目
vue create myproject // 项目名不能大写,中文
? Your connection to the default npm registry seems to be slow.
Use https://registry.npm.taobao.org for faster installation? (Y/n) n
( 默认npm注册连接慢,是否使用淘宝镜像)
? Please pick a preset: (Use arrow keys) ——选择配置
> default (babel, eslint) —— 默认
Manually select features —— 手动选择特性 选它
//下列 按空格选择
>(*) Babel
( ) TypeScript
( ) Progressive Web App (PWA) Support —— 先进web app
( ) Router
( ) Vuex
( ) CSS Pre-processors —— css预处理器
( ) Linter / Formatter —— ESLinter
( ) Unit Testing
( ) E2E Testing
? Where do you prefer placing config for Babel, PostCSS, ESLint, etc.? (Use arrow keys)
( 这些配置文件放到哪)
> In dedicated config files )—— 单独的配置文件夹
In package.json —— 放在package.json中
? Save this as a preset for future projects? (y/N) —— 保存,往后不必重新选择
y —— 是,会要求保存一个名字/N
项目目录结构:
package.json 后面显示Untracked 未跟踪