Last active
June 28, 2018 22:08
-
-
Save mzgoddard/917207ea6444c04eaf62f9907f891a2a to your computer and use it in GitHub Desktop.
Little webpack plugin for digging out some time info
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Drop this in as the first plugin in a webpack config | |
{ | |
apply: function(compiler) { | |
var start; | |
compiler.plugin(['watch-run', 'run'], function(compiler, cb) { | |
start = Date.now(); | |
cb(); | |
}); | |
compiler.plugin('make', function(compilation, cb) { | |
console.log('pre-make', Date.now() - start); | |
start = Date.now(); | |
compilation.plugin('seal', function() { | |
console.log('make', Date.now() - start); | |
start = Date.now(); | |
}); | |
compilation.plugin('optimize-tree', function(chunks, modules, cb) { | |
console.log('pre optimize-tree', Date.now() - start); | |
start = Date.now(); | |
cb(); | |
}); | |
compilation.plugin('after-optimize-tree', function() { | |
console.log('optimize-tree', Date.now() - start); | |
start = Date.now(); | |
}); | |
compilation.plugin('after-optimize-assets', function() { | |
console.log('post optimize-tree', Date.now() - start); | |
start = Date.now(); | |
}); | |
cb(); | |
}); | |
compiler.plugin('emit', function(compilation, cb) { | |
console.log('after-compile', Date.now() - start); | |
start = Date.now(); | |
cb(); | |
}) | |
compiler.plugin('done', function() { | |
console.log('emit', Date.now() - start); | |
}); | |
}, | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment