// webpack.config.js
devServer: {
host: '0.0.0.0',
port: 4002,
overlay: true,
open: true
}
I add the host: '0.0.0.0' in order to access the server via my IP address.
I add open: true in order to open the page in my browser automatically.
webpack-dev-server should open a tab with a proper url.
It opens the page in the browser with this url: 0.0.0.0:4002.
If I remove host: '0.0.0.0' from the config, I can not open the page with my url address anymore but only with localhost.
@PierBJX Try using the openPage option to specify the URL you want to open (https://webpack.js.org/configuration/dev-server/#devserveropenpage). The open option just tries to infer the URL you want using the host option.
Thanks @Loonride it works now 馃
devServer: {
host: '0.0.0.0',
port: 4002,
overlay: true,
open: true,
openPage: 'http://localhost:4002'
}
@Loonride maybe we should handle this case, what are you thinking?
@Loonride maybe we should handle this case, what are you thinking?
Yes, should it just be this particular case where 0.0.0.0 becomes localhost? Because if 0.0.0.0 is the host option, we don't have any better guess as to what the user wants.
Most helpful comment
Thanks @Loonride it works now 馃