Vue-element-admin: 配置devServer.open; true。Chrome浏览器会自动打开两次。

Created on 8 Jun 2019  ·  7Comments  ·  Source: PanJiaChen/vue-element-admin

Question(提问)

Steps to reproduce(问题复现步骤)


vue.config.is 中配置
devServer: {
port: port,
open: true,
overlay: {
warnings: false,
errors: true
},
如果open: true,Chrome会自动打开两次,一次是刚开始编译时,第二次是编译完成后。如果open: false,Chrome不会自动打开。

Other relevant information(格外信息)

  • Your OS: win10.1809
  • Node.js version: 10.15.3
  • vue-element-admin version: 4.2.1

Most helpful comment

我也遇到了这个问题,我的做法是将 vue.config.js 中的 open 配置改为 false,然后在 package.json 中的 "dev": "vue-cli-service serve" 后面增加 --open 选项。

https://cli.vuejs.org/zh/guide/cli-service.html#vue-cli-service-serve

All 7 comments

解决了吗

估计是版本兼容问题,重新用vue-cli搭建就可以了。

我也遇到这个问题了.

同遇到

我也遇到了这个问题,我的做法是将 vue.config.js 中的 open 配置改为 false,然后在 package.json 中的 "dev": "vue-cli-service serve" 后面增加 --open 选项。

https://cli.vuejs.org/zh/guide/cli-service.html#vue-cli-service-serve

@bot960528 ,我之后用vue-cli重新搭建了初始环境, vue.config.js配置devServer: { open: true },浏览器正确打开,之后把代码导入,依赖是命令行安装的,没有直接配置,浏览器正确打开。完了对比package-lock.json,觉得可能是版本问题。

https://github.com/vuejs/vue-cli/pull/4079

官方之前就修复了。

Was this page helpful?
0 / 5 - 0 ratings