Webpack-dev-server: WDS not opening a browser tab when `open: true` is set (Node API)

Created on 26 Sep 2018  路  4Comments  路  Source: webpack/webpack-dev-server

  • Operating System: Ubuntu 18.04
  • Node Version: v10.11.0
  • NPM Version: 6.4.1
  • webpack Version: 4.20.2
  • webpack-dev-server Version: 3.1.9
  • [x] This is a bug
  • [ ] This is a modification request

Code

You can check out this barebones repo reproducing the issue.

The WDS is using via it's Node API with open: true.

Expected Behavior

Browser tab should open

Actual Behavior

No browser tab is opened

For Bugs; How can we reproduce the behavior?

You can check out this barebones repo reproducing the issue.

3 (important) server 3 (broken) bug

All 4 comments

Confirmed this doesn't work via the bare Node API atm, you could use

webpack.config.js

const config = {
  //...
  devServer: {
    open: true
  }
};

in the meantime

/cc @hiroppy after refactor bin it should be easy to fix, can you help with this too, you are do amazing job :+1: Just need move event handler in Server instead bin, same problem for bonjour

open(https://github.com/webpack/webpack-dev-server/blob/master/bin/utils.js#L91-L95) seems to be called only by webpack-dev-server.js(https://github.com/webpack/webpack-dev-server/blob/master/bin/webpack-dev-server.js) (as status).
package.json calls "lib/Server.js".

@hiroppy yep, we should move all what starting with https://github.com/webpack/webpack-dev-server/blob/master/bin/webpack-dev-server.js#L172 in lib/Server, it is fix open/ when you use Node API, i think it is architecture bug and will be great fix it.

Was this page helpful?
0 / 5 - 0 ratings