# webpack-dev-middleware-koa2

> webpack dev middleware for koa

Latest version **1.0.1** (published 2017-08-29) · 0 weekly downloads

## Install

```sh
npm install webpack-dev-middleware-koa2
pnpm add webpack-dev-middleware-koa2
yarn add webpack-dev-middleware-koa2
bun add webpack-dev-middleware-koa2
```

## 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.1 |
| Published | 2017-08-29 |
| First published | 2017-08-29 |
| 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 |
| Author | yiminghe@gmail.com |
| Maintainers | ruizhao |
| Keywords | koa, webpack, middleware |

## Links

- npm: https://www.npmjs.com/package/webpack-dev-middleware-koa2
- Repository: https://github.com/zhaorui19910121/koa-webpack-dev-middleware
- Homepage: https://github.com/zhaorui19910121/koa-webpack-dev-middleware/tree/2.x
- Issues: https://github.com/zhaorui19910121/koa-webpack-dev-middleware/issues
- npm.io page: https://npm.io/package/webpack-dev-middleware-koa2

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

- 1.0.1 (latest) — 2017-08-29
- 1.0.0 — 2017-08-29

## README

# koa-webpack-dev-middleware

webpack dev middleware for koa 2.x

a copy of https://github.com/yiminghe/koa-webpack-dev-middleware/tree/2.x

For the author not publish its 2.x version， so I can't use it in the product environment. So I forked it and publish it.

[![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/webpack-dev-middleware-koa2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
