Skip to content

Instantly share code, notes, and snippets.

@beatak
Created June 21, 2018 23:35
Show Gist options
  • Save beatak/ac82e47684635dd916cd71413e82075f to your computer and use it in GitHub Desktop.
Save beatak/ac82e47684635dd916cd71413e82075f to your computer and use it in GitHub Desktop.
class CrudeTimingPlugin {
apply(compiler) {
compiler.plugin('compilation', compilation => {
let startOptimizePhase;
compilation.plugin('optimize-chunk-assets', (_chunks, callback) => {
// Cruddy way of measuring minification time. UglifyJSPlugin does all
// its work in this phase of compilation so we time the duration of
// the entire phase
startOptimizePhase = Date.now();
// For async phases: don't forget to invoke the callback
callback();
});
compilation.plugin('after-optimize-chunk-assets', () => {
/* eslint-disable no-console */
console.log(`*** optimize-chunk-asset PAHSE DURATION: ${Date.now() - startOptimizePhase} ***`);
});
});
}
}
module.exports = CrudeTimingPlugin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment