vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.75k stars 6.33k forks source link

vue-cli may open browser twice auto if I set 'devServer.open' : true #4108

Closed doubleKGe closed 5 years ago

doubleKGe commented 5 years ago

Version

3.8.0

Environment info

System:
    OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
  Binaries:
    Node: 8.10.0 - /usr/bin/node
    Yarn: 1.15.2 - ~/.yarn/bin/yarn
    npm: 6.8.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 67.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.8.0 
    @vue/babel-preset-jsx:  1.0.0 
    @vue/babel-sugar-functional-vue:  1.0.0 
    @vue/babel-sugar-inject-h:  1.0.0 
    @vue/babel-sugar-v-model:  1.0.0 
    @vue/babel-sugar-v-on:  1.0.0 
    @vue/cli-overlay:  3.8.0 
    @vue/cli-plugin-babel: ^3.5.0 => 3.8.0 
    @vue/cli-plugin-typescript: ^3.5.0 => 3.8.1 
    @vue/cli-service: ^3.5.0 => 3.8.0 
    @vue/cli-shared-utils:  3.8.0 
    @vue/component-compiler-utils:  2.6.0 
    @vue/web-component-wrapper:  1.2.0 
    vue: ^2.6.6 => 2.6.10 
    vue-class-component: ^6.0.0 => 6.3.2 
    vue-cli-plugin-quasar: ^0.17.1 => 0.17.1 
    vue-datetime:  1.0.0-beta.10 
    vue-easytable: ^1.7.2 => 1.7.2 
    vue-hot-reload-api:  2.3.3 
    vue-i18n: ^7.8.1 => 7.8.1 
    vue-loader: ^15.6.4 => 15.7.0 
    vue-property-decorator: ^7.0.0 => 7.3.0 
    vue-router: ^3.0.1 => 3.0.6 
    vue-style-loader: ^4.1.2 => 4.1.2 
    vue-template-compiler: ^2.5.21 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
    vuex: ^3.0.1 => 3.1.1 
  npmGlobalPackages:
    @vue/cli: 3.3.0

Steps to reproduce

set 'devServer.open' to true in vue.config.js and run 'vue-cli-service serve'

What is expected?

fix this bug

What is actually happening?

when I set 'devServer.open': true in vue.config.js, vue-cli may open browser twice auto

LinusBorg commented 5 years ago

duplicate: #4032

aljaxus commented 5 years ago

duplicate: #4032

Sorry for a late reply, but this is not a duplicate issue. The issue @LinusBorg referenced is not even similar to this one.

As I understand this one, though it does lack quite a lot of info and it's not really well-documented, it is stating that when in environment (very poorly) described above, and if the devServer.open is set to true in vue.config.js file, the VueCli might open two new tabs instead of just one.

While the referenced issue ( #4032 ) is related to a totally unrelated fact, that the "open app" button in VueCli-UI under the :serve action tab opens a new tab for localhost host and not the one that the UI is actually accessed from.

Please correct me if I'm wrong or if there's a need for further explanation.

doubleKGe commented 5 years ago

@aljaxus Yes , the VueCli would open two tabs in browser if devServer.open is setted to true in vue.config.js file. And this is the first time I have encountered this problem since the updated version from 3.5.0 to 3.8.0

LinusBorg commented 5 years ago

I'm pretty sure there was another issue about this but it seems I linked the wrong one.

I'll reopen now and check later

haoqunjiang commented 5 years ago

Fixed in 3.8.3