公司的项目clone下来运行了下发现会打开两次,看了scripts也没运行两次:
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src",
"test:unit": "jest --clearCache && vue-cli-service test:unit",
"test:ci": "npm run lint && npm run test:unit",
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
},
vue.config.js 下的 devServer.open 设置为 false
package.json 的 dev 命令设置为 vue-cli-service serve --open
查了下这个方法可行。
不过感觉根本问题不是这个,看了下别的项目devServer.open是true,dev命令是vue-cli-service serve也只是打开一次。待填坑。