Webpack Dev Server defaults to using localhost as its host. This can easily be overwritten by specifying the host
parameter with either a hostname
or IP address
. However, it seems that you can only specify one. For example, if I specify the IP Address 192.168.1.20
, then it stops responding to localhost
. How can I configure Webpack Dev Server to listen to multiple hosts?
webpack-dev-server is Webpack's officially supported CLI-based tool for starting a static server for your assets. While you don't need any CLI tools to use Webpack, webpack-dev-server gives you a single command that starts a static server with built-in live reload.
Webpack Dev Middleware is middleware which can be mounted in an express server to serve the latest compilation of your bundle during development. This uses webpack 's Node API in watch mode and instead of outputting to the file system it outputs to memory.
Exists only in webpack-dev-server. It's only needed if you want to serve static files. For example, you want a folder of mp4 vacation movies to be available for the app, but you don't want to run them through the bundle, because that would be silly.
webpack-dev-server on port 8080 .
0.0.0.0
is the catch-all host
and will bind to all hosts.
Example:
devServer: {
port: 3000,
host: '0.0.0.0'
}
Source: https://github.com/webpack/webpack-dev-server/issues/400#issuecomment-201213206
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With