Webpack dev and hot module replacement middleware for Koa2 (Koa v2.x). Version 1.0.7 is the latest stable release (last updated 2016). This package wraps webpack-dev-middleware and webpack-hot-middleware for Koa2, enabling development-time HMR with webpack. It is designed specifically for Koa2 (v2.x) and does not support Koa v1. Compared to alternatives like koa-webpack, this package is simpler but outdated and unmaintained. It requires a specific older webpack configuration (e.g., NoErrorsPlugin, OccurrenceOrderPlugin) and does not work with modern webpack 5. Users should consider migrating to koa-webpack or using webpack-dev-middleware directly.
npm install koa-webpack-middlewareVerified import paths — ran on the pinned version, not inferred.
Sets up Koa2 with webpack dev and hot middleware for HMR during development.
Migrate to koa-webpack: npm install koa-webpack
Use Koa version ^2.0.0
Use named imports as shown in documentation
Add these plugins to webpack config. For webpack 4+, use NoEmitOnErrorsPlugin instead of NoErrorsPlugin.
Include 'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000' in your entry array.
npm install webpack-dev-middleware --save-dev
npm install webpack-hot-middleware --save-dev
Use import { devMiddleware } from 'koa-webpack-middleware'