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:
commit
e493064c34
2
index.js
2
index.js
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue