解決: 需要修改兩個文件
// vue.config.js 註釋掉 open: true
publicPath: '/',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false,
devServer: {
port: port,
// open: true, 註釋掉本行
overlay: {
warnings: false,
errors: true
},
before: require('./mock/mock-server.js')
},
// package.json 在第二行代碼中 加上 --open 否則一個窗口都不打開
"scripts": {
"dev": "vue-cli-service serve --open",
"build:prod": "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"
},