Update compiler.js

ref #353 handle err before any logic in promise return by compileTemplate
This commit is contained in:
wuzhanwei 2016-06-15 13:40:25 +08:00 committed by GitHub
parent fa25bd7718
commit e493348953
1 changed files with 4 additions and 0 deletions

View File

@ -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,