turn webpack middleware into middleware

fix HMR middleware, and some loopback boilerplate cleanup
This commit is contained in:
2017-01-22 12:02:04 -07:00
parent c85b2e2702
commit f9e237da09
13 changed files with 75 additions and 61 deletions

View File

@@ -0,0 +1,12 @@
const webpackHotMiddleware = require('webpack-hot-middleware');
const webpack = require('./helpers/webpack');
const isProduction = (process.env.NODE_ENV === 'production');
module.exports = (params) => {
if (isProduction || params.enabled !== true) return (req, res, next) => next();
const middleware = webpackHotMiddleware(webpack.compiler);
return (req, res, next) => middleware(req, res, next);
};