Is there a way to configure webpack-dev-server to open a specified browser window ? For example Chrome Canary on mac
Looks like they added a possibility to set a browser name in open
option in v2.8.0.
Note that at least for some browsers browser name will be OS-specific (it seems to be passed directly to opn
package, therefore, same rules):
https://github.com/webpack/webpack-dev-server/pull/825
In addition to googling, you may want to search in package's repository Issues as well. Takes some time and "popularity" before google shows it on top of other matches.
This is how I fixed the issue. In package.json:
"start": "webpack-dev-server --config webpack.dev.js --open chrome",
of course, you can use webpack.config.js instead webpack.dev.js
In webpack.config.js:
devServer: {
...
open: 'chrome'
},
This is for Google Chrome, so just use any other browser name.
For MacOS:
- Don't use the devServer property in webpack.config.js
- Use this in package.json:
"start": "webpack-dev-server --open 'google chrome'"