Created
October 13, 2016 09:39
-
-
Save legend80s/9c179be8a4f9c93ff3182ee2d3c301ac to your computer and use it in GitHub Desktop.
Show Webpack Bundling Start and Stop Time
This file contains hidden or 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
/* 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