# koa-webpack-dev-middleware

> webpack dev middleware for koa

Latest version **2.0.2** (published 2017-09-29) · 0 weekly downloads

## Install

```sh
npm install koa-webpack-dev-middleware
pnpm add koa-webpack-dev-middleware
yarn add koa-webpack-dev-middleware
bun add koa-webpack-dev-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 | 2.0.2 |
| Published | 2017-09-29 |
| First published | 2015-03-30 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=7.6.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 93 |
| Author | yiminghe@gmail.com |
| Maintainers | yiminghe |
| Keywords | koa, webpack, middleware |

## Links

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

## Dependencies (1)

- [webpack-dev-middleware](https://npm.io/package/webpack-dev-middleware.md) ^1.10.0

## 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

- 2.0.2 (latest) — 2017-09-29
- 2.0.1 — 2017-08-03
- 2.0.0 — 2017-06-28
- 1.4.6 — 2017-05-18
- 1.4.5 — 2017-03-17
- 1.4.4 — 2017-02-04
- 1.4.3 — 2017-02-04
- 1.4.2 — 2017-02-04
- 1.4.1 — 2017-02-04
- 1.4.0 — 2017-02-04
- 1.3.0 — 2016-11-07
- 1.2.2 — 2016-08-18
- 1.2.1 — 2016-05-11
- 1.2.0 — 2016-03-10
- 1.1.0 — 2015-12-16
- … 2 more at https://npm.io/package/koa-webpack-dev-middleware/versions

## README

# koa-webpack-dev-middleware

webpack dev middleware for koa 2.x

[![node version][node-image]][node-url]

[node-image]: https://img.shields.io/badge/node.js-%3E=_7.6.0-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/

## Usage

same with https://github.com/webpack/webpack-dev-middleware. will add original middleware to ctx.webpack


```js
var app = require('koa')();
var webpackMiddleware = require("koa-webpack-dev-middleware");
app.use(webpackMiddleware(...));

```

### Example usage

```js
var app = require('koa')();
app.use(webpackMiddleware(webpack({
    // webpack options
    // webpackMiddleware takes a Compiler object as first parameter
    // which is returned by webpack(...) without callback.
    entry: "...",
    output: {
        path: "/"
        // no real path is required, just pass "/"
        // but it will work with other paths too.
    }
}), {
    // all options optional

    noInfo: false,
    // display no info to console (only warnings and errors)

    quiet: false,
    // display nothing to the console

    lazy: true,
    // switch into lazy mode
    // that means no watching, but recompilation on every request

    watchDelay: 300,
    // delay after change (only lazy: false)

    publicPath: "/assets/",
    // public path to bind the middleware to
    // use the same as in webpack

    headers: { "X-Custom-Header": "yes" },
    // custom headers

    stats: {
        colors: true
    }
    // options for formating the statistics
}));
```

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