Setting devServer.open='chrome' does not work
Version
3.0.0-rc.12
Node and OS info
Node 8.9.4 / npm 5.5.1 / Windows 10
Steps to reproduce
create a project with default settings, and set devServer:{open:'chrome'} in vue.config.js, then do npm run serve.
What is expected?
chrome automatically opened
What is actually happening?
system default browser opened
In the webpack documentation, the devServer.open option allows passing a string to specify which browser to open. That used to work when using vue-cli 2.x.
Vue CLI uses a different open implementation to avoid opening duplicated windows, so we need to document that.
@yyx990803 so how could we open another browser, instead of the default one.
I dug through the code and figured out I needed to define environment variable BROWSER.
export BROWSER="Google Chrome"
@yyx990803 why not get browser from devServer.open, but use process args instead?
I think this config would better to compatible with original webpack-dev-server, like the docs wrote, thanks.
https://cli.vuejs.org/config/#devserver
function getBrowserEnv () {
// Attempt to honor this environment variable.
// It is specific to the operating system.
// See https://github.com/sindresorhus/open#app for documentation.
const value = process.env.BROWSER