Skip to content

Instantly share code, notes, and snippets.

@whudson
Created March 28, 2022 00:59
Show Gist options
  • Save whudson/b4323a27306970b17aec51398a35dd64 to your computer and use it in GitHub Desktop.
Save whudson/b4323a27306970b17aec51398a35dd64 to your computer and use it in GitHub Desktop.
Webpack plugin to output some info about the build
class OutputBuildInfoPlugin { // webpack plugin
apply(compiler) {
compiler.hooks.done.tap('OutputBuildInfo', (stats) => {
let dateString = new Intl.DateTimeFormat('en-US', {
hour: "numeric",
minute: "numeric",
second: "numeric",
year: "numeric",
month: "2-digit",
day: "2-digit",
}).format(new Date()).replace(',', '');
console.log(`Hash: ${stats.hash}`);
console.log(`Built at: ${dateString}`)
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment