Guest User

Untitled

a guest
Jun 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. class CrudeTimingPlugin {
  2. apply(compiler) {
  3. compiler.plugin('compilation', compilation => {
  4. let startOptimizePhase;
  5.  
  6. compilation.plugin('optimize-chunk-assets', (_chunks, callback) => {
  7. // Cruddy way of measuring minification time. UglifyJSPlugin does all
  8. // its work in this phase of compilation so we time the duration of
  9. // the entire phase
  10. startOptimizePhase = Date.now();
  11.  
  12. // For async phases: don't forget to invoke the callback
  13. callback();
  14. });
  15.  
  16. compilation.plugin('after-optimize-chunk-assets', () => {
  17. /* eslint-disable no-console */
  18. console.log(`*** optimize-chunk-asset PAHSE DURATION: ${Date.now() - startOptimizePhase} ***`);
  19. });
  20. });
  21. }
  22. }
  23.  
  24. module.exports = CrudeTimingPlugin;
Add Comment
Please, Sign In to add comment