Skip to content

Commit

Permalink
Document middleware config options
Browse files Browse the repository at this point in the history
  • Loading branch information
glenjamin committed Jan 10, 2017
1 parent a5bcc69 commit 03b790f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Expand Up @@ -73,6 +73,8 @@ More to come soon, you'll have to mostly rely on the example for now.

### Config

#### Client

Configuration options can be passed to the client by adding querystring parameters to the path in the webpack config.

```js
Expand All @@ -88,6 +90,22 @@ Configuration options can be passed to the client by adding querystring paramete
* **quiet** - Set to `true` to disable all console logging.
* **dynamicPublicPath** - Set to `true` to use webpack `publicPath` as prefix of `path`. (We can set `__webpack_public_path__` dynamically at runtime in the entry point, see note of [output.publicPath](https://webpack.github.io/docs/configuration.html#output-publicpath))

#### Middleware

Configuration options can be passed to the middleware by passing a second arugment.

```js
app.use(require("webpack-hot-middleware")(compiler, {
log: false,
path: "/__what",
heartbeat: 2000
}));
```

* **log** - A function used to log lines, pass `false` to disable. Defaults to `console.log`
* **path** - The path which the middleware will serve the event stream on, must match the client setting
* **heartbeat** - How often to send heartbeat updates to the client to keep the connection alive. Should be less than the client's `timeout` setting - usually set to half its value.

## How it Works

The middleware installs itself as a webpack plugin, and listens for compiler events.
Expand Down

0 comments on commit 03b790f

Please sign in to comment.