# koa-webpack-hot-middleware

> webpack hot reload middleware for koa

Latest version **1.0.3** (published 2015-12-17) · 0 weekly downloads

## Install

```sh
npm install koa-webpack-hot-middleware
pnpm add koa-webpack-hot-middleware
yarn add koa-webpack-hot-middleware
bun add koa-webpack-hot-middleware
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2015-12-17 |
| First published | 2015-08-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 47 |
| Author | andrey.slider@gmail.com |
| Maintainers | day-alone |
| Keywords | koa, webpack, middleware |

## Links

- npm: https://www.npmjs.com/package/koa-webpack-hot-middleware
- Repository: https://github.com/dayAlone/koa-webpack-hot-middleware
- Homepage: http://github.com/dayAlone/koa-webpack-hot-middleware
- Issues: http://github.com/dayAlone/koa-webpack-hot-middleware/issues
- npm.io page: https://npm.io/package/koa-webpack-hot-middleware

## Dependencies (1)

- [webpack-hot-middleware](https://npm.io/package/webpack-hot-middleware.md) 2.x

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2015-12-17
- 1.0.2 — 2015-12-17
- 1.0.1 — 2015-08-29

## README

# koa-webpack-hot-middleware

webpack hot reload middleware for koa

## Usage

same with https://github.com/glenjamin/webpack-hot-middleware

# Webpack Hot Middleware

Webpack hot reloading using only [webpack-dev-middleware](http://webpack.github.io/docs/webpack-dev-middleware.html). This allows you to add hot reloading into an existing server without [webpack-dev-server](http://webpack.github.io/docs/webpack-dev-server.html).

## Installation & Usage

See [example/](./example/) for an example of usage.

First, install the npm module.

```sh
npm install --save-dev koa-webpack-hot-middleware
```

Next, enable hot reloading in your webpack config:

 1. Add the following three plugins to the `plugins` array:
    ```js
    plugins: [
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin()
    ]
    ```
    Occurence ensures consistent build hashes, hot module replacement is
    somewhat self-explanatory, no errors is used to handle errors more cleanly.

 3. Add `'webpack-hot-middleware/client'` into the `entry` array.
    This connects to the server to receive notifications when the bundle
    rebuilds and then updates your client bundle accordingly.

Now add the middleware into your server:

 1. Add `webpack-dev-middleware` the usual way
    ```js
    var webpack = require('webpack');
    var webpackConfig = require('./webpack.config');
    var compiler = webpack(webpackConfig);

    app.use(require("webpack-dev-middleware")(compiler, {
        noInfo: true, publicPath: webpackConfig.output.publicPath
    }));
    ```

 2. Add `koa-webpack-hot-middleware` attached to the same compiler instance
    ```js
    app.use(require("koa-webpack-hot-middleware")(compiler));
    ```

And you're all set!

## License

Copyright 2015 Glen Mailer.

MIT Licened.

---
_Source: https://npm.io/package/koa-webpack-hot-middleware · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
