diff --git a/templates/HandlebarsTemplatePlugin.js b/templates/HandlebarsTemplatePlugin.js index 5c4278da369197060eb55c5db7c7ec5c5218d100..b7fd87f018f3d535c9277f952ce463aa16b4b573 100644 --- a/templates/HandlebarsTemplatePlugin.js +++ b/templates/HandlebarsTemplatePlugin.js @@ -36,8 +36,12 @@ class HandlebarsTemplatePlugin { }); // Compile templates on each webpack compilation - compiler.plugin("emit", (compilation, callback) => { - this.compileTemplates(compiler, compilation).then(callback); + compiler.plugin("after-emit", (compilation, callback) => { + this.compileTemplates(compiler, compilation) + .then(callback) + .catch(err => { + compilation.errors.push(err); + }); }); }