Shall we write the file to disk only after Webpack finished bundling our code? We could make use the compiler done callback as noted here on the official docs.
function HelloWorldPlugin(options) {
// Setup the plugin instance with options...
}
HelloWorldPlugin.prototype.apply = function(compiler) {
compiler.plugin('done', function() {
console.log('Hello World!');
});
};
module.exports = HelloWorldPlugin;