webpack-dev-middleware-for-koa

1.1.1 • Public • Published

webpack-dev-middleware-for-koa

webpack dev middleware for koa 2.x.

Usage

const app = require('koa')();
const webpackMiddleware = require("webpack-dev-middleware-for-koa2");
app.use(webpackMiddleware(...));

Example usage

const 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
      publicPath: webpackDevConfig.output.publicPath, // 增加路由访问前缀
      logLevel: "error",
}));

Package Sidebar

Install

npm i webpack-dev-middleware-for-koa

Weekly Downloads

9

Version

1.1.1

License

MIT

Unpacked Size

5.67 kB

Total Files

5

Last publish

Collaborators

  • better-vae