Webpack-dev-server: Automatically open browser

Created on 5 Nov 2015  路  10Comments  路  Source: webpack/webpack-dev-server

Please add a flag to webpack-dev-server that will automatically open the browser to the configured url.

Most helpful comment

should have option to define which browser to use

All 10 comments

Can you test if #329 works as you would expect?

should have option to define which browser to use

and is it possible to open open something else?... let's say open /something/else

Is --open exposed to webpack's Node.js API? I would like to do this:

new WebpackDevServer(webpack(config), {
  publicPath: config.output.publicPath,
  hot: true,
  historyApiFallback: true,
  inline: true,
  stats: { colors: true },
  headers: { 'Access-Control-Allow-Origin': '*' },
  open: 'http://localhost:8081'
}).listen(8081, 'localhost', function (err, result) {
  if (err) {
    return console.log(err);
  }
  console.log('Listening at http://localhost:8081/');
});

@bennyn did you manage to do this ?

In my webpack.config.js:
devServer: { open: false }
does not prevent webpack to open app in new page.
I am using webpack 3.6.0 webpack-dev-server 2.9.1

Does it work for anyone?

For me devServer: { open: false } doesn't work either.

@SpaceK33z I'm trying to use the open option on a webpack config via the Node API based on https://webpack.js.org/configuration/dev-server/#devserver-open. However, it won't work. Is this supposed to work outside of the CLI?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adiachenko picture adiachenko  路  3Comments

antoinerousseau picture antoinerousseau  路  3Comments

StephanBijzitter picture StephanBijzitter  路  3Comments

uMaxmaxmaximus picture uMaxmaxmaximus  路  3Comments

Ky6uk picture Ky6uk  路  3Comments