Skip to content

Instantly share code, notes, and snippets.

@legend80s
Created October 13, 2016 09:39
Show Gist options
  • Save legend80s/9c179be8a4f9c93ff3182ee2d3c301ac to your computer and use it in GitHub Desktop.
Save legend80s/9c179be8a4f9c93ff3182ee2d3c301ac to your computer and use it in GitHub Desktop.
Show Webpack Bundling Start and Stop Time
/* eslint-disable no-console */
//
// Bundle start at: 10/13/2016, 5:35:37 PM
// Bundle stop at: 10/13/2016, 5:35:43 PM
//
const colors = require('colors');
colors.setTheme({
info: 'green',
prompt: 'white',
});
function LogPlugin() {}
LogPlugin.prototype.apply = function apply(compiler) {
let bundleStart = null;
let bundleStop = null;
compiler.plugin('compile', () => {
bundleStart = new Date();
const startMsg = '\nBundle start at: '.prompt + bundleStart.toLocaleString().info;
console.log(startMsg);
});
compiler.plugin('done', () => {
bundleStop = new Date();
const stopMsg = '\nBundle stop at: '.prompt + bundleStop.toLocaleString().info;
console.log(stopMsg);
});
};
module.exports = LogPlugin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment