Detalhes do pacote

webpack-dev-middleware-for-koa

tnnevol57MIT1.1.1

用于koa2的webpack-dev-middleware的中间件

tnnevol, newblue, koa2, webpack

readme (leia-me)

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",
}));