koa-webpack-middleware icon indicating copy to clipboard operation
koa-webpack-middleware copied to clipboard

Combine Setup for Efficiency

Open shellscape opened this issue 8 years ago • 4 comments

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.

shellscape avatar Oct 19 '16 18:10 shellscape

Ended up releasing https://github.com/shellscape/koa-webpack. I guess koa-webpack-middleware isn't maintained or watched by the author anymore.

shellscape avatar Oct 21 '16 18:10 shellscape

@shellscape thank you so much! We should move a link to your repo into the webpack documentation.

axe312ger avatar Nov 17 '16 15:11 axe312ger

@axe312ger you're welcome! I'd be all for that.

shellscape avatar Nov 17 '16 16:11 shellscape

@shellscape just found this -> https://github.com/webpack/webpack-dev-middleware/issues/148

axe312ger avatar Nov 17 '16 18:11 axe312ger