Skip to content

配置devServer.open; true。Chrome浏览器会自动打开两次。 #2205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bahuwang opened this issue Jun 8, 2019 · 7 comments
Closed

Comments

@bahuwang
Copy link

bahuwang commented Jun 8, 2019

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
@dnsritch
Copy link

解决了吗

@bahuwang
Copy link
Author

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

@KyleChen2019
Copy link

我也遇到这个问题了.

@main2018
Copy link

同遇到

@AemonCao
Copy link

AemonCao commented Jun 28, 2019

我也遇到了这个问题,我的做法是将 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

@bahuwang
Copy link
Author

bahuwang commented Jul 3, 2019

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

@PanJiaChen
Copy link
Owner

vuejs/vue-cli#4079

官方之前就修复了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants