①:安装 webpack-dev-server
npm install --save-dev webpack-dev-server
②:修改vue.config.js配置
devServer: {
port: 3033,
host: "0.0.0.0",
https: false, // https:{type:Boolean}
open: true, // 配置自动启动浏览器
disableHostCheck: true, //webpack4.0 开启热更新
},
③:更改packjson.js
"serve": "vue-cli-service serve && webpack-dev-server --open",
④:重启项目