koa-webpack-middleware
koa-webpack-middleware copied to clipboard
Combine Setup for Efficiency
I'd like to request refactoring to combine all of the setup between dev-middleware and hot-middleware. I've never seen an example where they aren't app.use'd in succession, and given that their options are distinct this should be a trivial refactor:
import packWare from 'koa-webpack-middleware';
app.use(packWare({
dev: // dev options,
hot: // hot options,
compiler: // optional webpack instance,
config: // optional webpack config. should look for webpack.config.js in root by default
]);
webpack
can be imported via a peerDependency entry for the webpack module in package.json
, or provided as part of the config of the middleware. This negates the need to set that portion up manually for each use of koa-webpack-middleware.
If you're open to this change, I'll put together a pull request. I'd also be happy to provide an example for Vue.js.
Ended up releasing https://github.com/shellscape/koa-webpack. I guess koa-webpack-middleware isn't maintained or watched by the author anymore.
@shellscape thank you so much! We should move a link to your repo into the webpack documentation.
@axe312ger you're welcome! I'd be all for that.
@shellscape just found this -> https://github.com/webpack/webpack-dev-middleware/issues/148