Skip to content
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

docs(devserver): add documentation for liveReload option #3051

Merged
merged 8 commits into from Jun 11, 2019
2 changes: 2 additions & 0 deletions src/content/api/cli.md
Expand Up @@ -11,6 +11,7 @@ contributors:
- EugeneHlushko
- byzyk
- wizardofhogwarts
- EslamHiko
related:
- title: Analyzing Build Statistics
url: https://survivejs.com/webpack/optimizing-build/analyzing-build-statistics/
Expand Down Expand Up @@ -299,6 +300,7 @@ Parameter | Explanation | Usage
`--define` | Define any free variable, see [shimming](/guides/shimming) | `--define process.env.NODE_ENV="'development'"`
`--hot` | Enables [Hot Module Replacement](/concepts/hot-module-replacement) | `--hot=true`
`--labeled-modules` | Enables labeled modules [Uses LabeledModulesPlugin] |
`--live-reload` | Enables page live reloading | `--live-reload=true`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`--live-reload` | Enables page live reloading | `--live-reload=true`
`--live-reload` | Enables live reloading | `--live-reload=true`

`--plugin` | Load this [plugin](/configuration/plugins/) |
`--prefetch` | Prefetch the particular file | `--prefetch=./files.js`
`--provide` | Provide these modules as globals, see [shimming](/guides/shimming) | `--provide jQuery=jquery`
Expand Down
23 changes: 23 additions & 0 deletions src/content/configuration/dev-server.md
Expand Up @@ -696,6 +696,29 @@ T> [`watchOptions`](#devserver-watchoptions-) will have no effect when used with

T> If you use the CLI, make sure __inline mode__ is disabled.

## `devServer.liveReload`

`boolean: true`

When `devServer.liveReload` is enabled, the dev-server will reload/refresh the page when file changes if [`devServer.hot`](#devserverhot) option is disabled or [`devServer.watchContentBase`](#devserverwatchcontentbase) is enabled.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When `devServer.liveReload` is enabled, the dev-server will reload/refresh the page when file changes if [`devServer.hot`](#devserverhot) option is disabled or [`devServer.watchContentBase`](#devserverwatchcontentbase) is enabled.
By default, the dev-server will reload/refresh the page when file changes are detected. [`devServer.hot`](#devserverhot) option must be disabled or [`devServer.watchContentBase`](#devserverwatchcontentbase) option must be enabled in order for `liveReload` to take effect. Disable `devServer.liveReload` by setting it to `false`:


__webpack.config.js__

```javascript
module.exports = {
//...
devServer: {
liveReload: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
liveReload: true
liveReload: false

}
};
```

Usage via the CLI

```bash
webpack-dev-server --live-reload
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this default? Why we need to pass it

```


## `devServer.mimeTypes` 🔑

Expand Down