Skip to content

Fixed examples for CLI-only DevServer options #1196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions content/configuration/dev-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ contributors:
- skipjack
- spacek33z
- charlespwd
- ingver
---

webpack-dev-server can be used to quickly develop an application. See the ["How to Develop?"](/guides/development) to get started.
Expand Down Expand Up @@ -170,8 +171,8 @@ For more options and information, see the [connect-history-api-fallback](https:/

Specify a host to use. By default this is `localhost`. If you want your server to be accessible externally, specify it like this:

```js
host: "0.0.0.0"
```bash
webpack-dev-server --host "0.0.0.0"
```


Expand All @@ -194,8 +195,8 @@ T> Note that you must also include a `new webpack.HotModuleReplacementPlugin()`

Enables Hot Module Replacement (see [`devServer.hot`](#devserver-hot)) without page refresh as fallback in case of build failures.

```js
hotOnly: true
```bash
webpack-dev-server --hot-only
```


Expand Down Expand Up @@ -230,8 +231,8 @@ Toggle between the dev-server's two different modes. By default the application

It is also possible to use **iframe mode**, which uses an `<iframe>` under a notification bar with messages about the build. To switch to **iframe mode**:

```js
inline: false
```bash
webpack-dev-server --inline
```

T> Inline mode is recommended when using Hot Module Replacement.
Expand Down Expand Up @@ -272,7 +273,7 @@ Shows a full-screen overlay in the browser when there are compiler errors or war
overlay: true
```

If you want to show warnings as well as errors:
If you want to show warnings as well as errors:

```js
overlay: {
Expand All @@ -281,7 +282,7 @@ overlay: {
}
```

## `devServer.port` - CLI only
## `devServer.port`

`number`

Expand All @@ -291,6 +292,10 @@ Specify a port number to listen for requests on:
port: 8080
```

```bash
webpack-dev-server --port 8080
```


## `devServer.proxy`

Expand Down Expand Up @@ -359,6 +364,10 @@ proxy: {

Output running progress to console.

```bash
webpack-dev-server --progress
```


## `devServer.public` - CLI only

Expand All @@ -368,8 +377,8 @@ When using *inline mode* and you're proxying dev-server, the inline client scrip

For example, the dev-server is proxied by nginx, and available on `myapp.test`:

```js
public: "myapp.test:80"
```bash
webpack-dev-server --public "myapp.test:80"
```


Expand Down