Merge pull request #375 from mgol/empty-templateContent

Don't treat templateContent set to an empty string as not specified
This commit is contained in:
Jan Nicklas 2016-07-06 23:59:39 +02:00 committed by GitHub
commit e493064c34
2 changed files with 15 additions and 1 deletions

View File

@ -107,7 +107,7 @@ HtmlWebpackPlugin.prototype.apply = function (compiler) {
})
.then(function (compiledTemplate) {
// Allow to use a custom function / string instead
if (self.options.templateContent) {
if (self.options.templateContent !== undefined) {
return self.options.templateContent;
}
// Once everything is compiled evaluate the html factory

View File

@ -1239,4 +1239,18 @@ describe('HtmlWebpackPlugin', function () {
]
}, ['templateParams.compilation exists: true'], null, done);
});
it('should not treat templateContent set to an empty string as missing', function (done) {
testHtmlPlugin({
entry: {app: path.join(__dirname, 'fixtures/index.js')},
output: {
path: OUTPUT_DIR,
filename: 'app_bundle.js'
},
plugins: [new HtmlWebpackPlugin({
templateContent: ''
})]
},
[/^<script type="text\/javascript" src="app_bundle\.js"><\/script>$/], null, done);
});
});