diff --git a/content/configuration/dev-server.md b/content/configuration/dev-server.md index da9f21fdb264..a17f7f528ad6 100644 --- a/content/configuration/dev-server.md +++ b/content/configuration/dev-server.md @@ -74,6 +74,27 @@ allowedHosts: [ ] ``` +To use this option with the CLI pass the `--allowed-hosts` option a comma-delimited string. + +```bash +webpack-dev-server --entry /entry/file --output-path /output/path --allowed-hosts .host.com,host2.com +``` + + +## `devServer.bonjour` + +This option broadcasts the server via ZeroConf networking on start + +```js +bonjour: true +``` + +Usage via the CLI + +```bash +webpack-dev-server --bonjour +``` + ## `devServer.clientLogLevel` @@ -87,11 +108,28 @@ You can prevent all these messages from showing, by using this option: clientLogLevel: "none" ``` +Usage via the CLI + +```bash +webpack-dev-server --client-log-level none +``` + Possible values are `none`, `error`, `warning` or `info` (default). Note that the console will *always* show bundle errors and warnings. This option only effects the message before it. +## `devServer.color` - CLI only + +`boolean` + +Enables/Disables colors on the console. + +```bash +webpack-dev-server --color +``` + + ## `devServer.compress` `boolean` @@ -102,6 +140,12 @@ Enable [gzip compression](https://betterexplained.com/articles/how-to-optimize-y compress: true ``` +Usage via the CLI + +```bash +webpack-dev-server --compress +``` + ## `devServer.contentBase` @@ -129,6 +173,29 @@ To disable `contentBase`: contentBase: false ``` +Usage via the CLI + +```bash +webpack-dev-server --content-base /path/to/content/dir +``` + + +## `devServer.disableHostCheck` + +`boolean` + +When set to true this option bypasses host checking. THIS IS NOT RECOMMENDED as apps that do not check the host are vulnerable to DNS rebinding attacks. + +```js +disableHostCheck: true +``` + +Usage via the CLI + +```bash +webpack-dev-server --disable-host-check +``` + ## `devServer.filename` 🔑 @@ -192,10 +259,16 @@ historyApiFallback: { } ``` +Usage via the CLI + +```bash +webpack-dev-server --history-api-fallback +``` + For more options and information, see the [connect-history-api-fallback](https://github.com/bripkens/connect-history-api-fallback) documentation. -## `devServer.host` - CLI only +## `devServer.host` `string` @@ -205,6 +278,12 @@ Specify a host to use. By default this is `localhost`. If you want your server t host: "0.0.0.0" ``` +Usage via the CLI + +```bash +webpack-dev-server --host 0.0.0.0 +``` + ## `devServer.hot` @@ -219,7 +298,7 @@ hot: true T> Note that you must also include a `new webpack.HotModuleReplacementPlugin()` to fully enable HMR. See the [HMR concepts page](/concepts/hot-module-replacement) for more information. -## `devServer.hotOnly` - CLI only +## `devServer.hotOnly` `boolean` @@ -229,6 +308,12 @@ Enables Hot Module Replacement (see [`devServer.hot`](#devserver-hot)) without p hotOnly: true ``` +Usage via the CLI + +```bash +webpack-dev-server --hot-only +``` + ## `devServer.https` @@ -252,8 +337,31 @@ https: { This object is passed straight to Node.js HTTPS module, so see the [HTTPS documentation](https://nodejs.org/api/https.html) for more information. +Usage via the CLI + +```bash +webpack-dev-server --https +``` + +To pass your own certificate via the CLI use the following options + +```bash +webpack-dev-server --https --key /path/to/server.key --cert /path/to/server.crt --cacert /path/to/ca.pem +``` + + +## `devServer.info` - CLI only + +`boolean` + +Output cli information. It is enabled by default. + +```bash +webpack-dev-server --info=false +``` + -## `devServer.inline` - CLI only +## `devServer.inline` `boolean` @@ -265,6 +373,12 @@ It is also possible to use **iframe mode**, which uses an `