diff --git a/README.md b/README.md index c1442a970..c8d64508c 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,10 @@ app.use(webpackMiddleware(webpack({ // switch into lazy mode // that means no watching, but recompilation on every request + onUpdate: function(stats) { doWhateverWithStats(stats); }, + // manually handle the stats from the last compilation + // can be combined with quiet and noInfo for full control over output + watchOptions: { aggregateTimeout: 300, poll: true diff --git a/middleware.js b/middleware.js index 5b52cf163..bb1527926 100644 --- a/middleware.js +++ b/middleware.js @@ -40,6 +40,10 @@ module.exports = function(compiler, options) { process.nextTick(function() { // check if still in valid state if(!state) return; + + // make a callback with stats + if(typeof options.onUpdate === 'function') options.onUpdate(stats); + // print webpack output var displayStats = (!options.quiet && options.stats !== false); if(displayStats &&