var _Date$now = require("@babel/runtime-corejs3/core-js-stable/date/now");

// Drop this in as the first plugin in a webpack config
module.exports = {
  apply: function (compiler) {
    let start;
    compiler.plugin(['watch-run', 'run'], (compiler, cb) => {
      start = _Date$now();
      cb();
    });
    compiler.plugin('make', (compilation, cb) => {
      console.log('pre-make', _Date$now() - start);
      start = _Date$now();
      compilation.plugin('seal', () => {
        console.log('make', _Date$now() - start);
        start = _Date$now();
      });
      compilation.plugin('optimize-tree', (chunks, modules, cb) => {
        console.log('pre optimize-tree', _Date$now() - start);
        start = _Date$now();
        cb();
      });
      compilation.plugin('after-optimize-tree', () => {
        console.log('optimize-tree', _Date$now() - start);
        start = _Date$now();
      });
      compilation.plugin('after-optimize-assets', () => {
        console.log('post optimize-tree', _Date$now() - start);
        start = _Date$now();
      });
      cb();
    });
    compiler.plugin('emit', (compilation, cb) => {
      console.log('after-compile', _Date$now() - start);
      start = _Date$now();
      cb();
    });
    compiler.plugin('done', () => {
      console.log('emit', _Date$now() - start);
    });
  }
};