vue-cli 要升级到4.5
npm install -g @vue/cli
# 或者
yarn global add @vue/cli
查看安装之后的vue-cli版本 vue --version
@vue/cli 4.5.8
进入目标目录,创建webpack项目
vue init webpack 项目名称
下面就按照提示根据需求逐步进行敲入
> Project name
> Project description
> Author
> Vue build standalone
> Install vue-router?
> Use ESLint to lint your code?
> Pick an ESLint preset Standard
> Set up unit tests
> Setup e2e tests with Nightwatch?
> Should we run `npm install` for you after the project has been created? (recommended)
cd到项目目录,执行:vue upgrade --next
✔ Gathering package information...
DONE Seems all plugins are up to date. Good work!
查看package.json
"dependencies": {
"vue": "^3.0.2",
"vue-router": "^3.0.1"
},
简单的搭建就结束了
vue-cli的webpack版本为3.6.0,可自行升级到更高版本,参照:
vue项目升级webpack4指南