koa2-hmr-middleware
v0.1.4
Published
HRM middleware ( webpack-dev-middleware, webpack-hot-middleware) for koa2
Downloads
3
Maintainers
Readme
koa2-hmr-middleware
HMR middleware ( webpack-dev-middleware, webpack-hot-middleware) for koa2
installation
$ npm i koa2-hmr-middleware -D
Usage
const hmrMiddleware = require('koa2-hmr-middleware');
const Koa = require('koa');
const webpack = require("webpack");
var app = new Koa();
var webpackConfig = require('./webpack.config');
var compiler = webpack(webpackConfig);
app.use(hmrMiddleware(compiler, {
dev: devMiddlewareConfig // configuration of webpack-dev-middleware
hot: hotMiddlewareConfig // configuration of webpack-hot-middleware
}))
or you can ...
app.use(hmrMiddleware.dev(compiler, devMiddlewareConfig))
app.use(hmrMiddleware.hot(compiler, hotMiddlewareConfig))
Configuration
TODO
- example
- support devMiddleware API
enjoy webpack HMR with Koa2 :blush: