Fix template compilation for es6 modules (#550)

This commit is contained in:
Arseny 2017-01-20 14:11:09 +03:00 committed by Jan Nicklas
parent 1b4f8efe94
commit 7a781a4120
1 changed files with 3 additions and 0 deletions

View File

@ -233,6 +233,9 @@ HtmlWebpackPlugin.prototype.evaluateCompilationResult = function (compilation, s
} catch (e) {
return Promise.reject(e);
}
if (typeof newSource === 'object' && newSource.__esModule && newSource.default) {
newSource = newSource.default;
}
return typeof newSource === 'string' || typeof newSource === 'function'
? Promise.resolve(newSource)
: Promise.reject('The loader "' + this.options.template + '" didn\'t return html.');