From e493348953a6c3903b5e2ad11b314ae4f71af239 Mon Sep 17 00:00:00 2001 From: wuzhanwei Date: Wed, 15 Jun 2016 13:40:25 +0800 Subject: [PATCH] Update compiler.js ref #353 handle err before any logic in promise return by compileTemplate --- lib/compiler.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/compiler.js b/lib/compiler.js index 326384e..613d4b3 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -68,6 +68,10 @@ module.exports.compileTemplate = function compileTemplate (template, context, ou // Compile and return a promise return new Promise(function (resolve, reject) { childCompiler.runAsChild(function (err, entries, childCompilation) { + if (err) { + reject(err); + return; + } // Replace [hash] placeholders in filename var outputName = compilation.mainTemplate.applyPluginsWaterfall('asset-path', outputOptions.filename, { hash: childCompilation.hash,