Search code examples
webpackwebpack-hmr

Is there a way in webpack watch mode to display on screen the timestamp when webpack last updated the build?


Sometimes while running webpack in watch mode and editing source files I am not sure whether webpack has packed my changes or not.

Is there a way to print a timestamp to the console each time webpack updates the bundle?


Solution

  • You can add a custom plugin like:

    config.plugins.push(new function() {
        this.apply = (compiler) => {
            compiler.hooks.done.tap("Log On Done Plugin", () => {
                console.log(("\n[" + new Date().toLocaleString() + "]") + " Begin a new compilation.\n");
            });
        };
    });