diff --git a/index.js b/index.js index f29b762d..7ce48402 100644 --- a/index.js +++ b/index.js @@ -705,7 +705,7 @@ class HtmlWebpackPlugin { if ( typeof newSource === "object" && newSource.__esModule && - newSource.default + newSource.default !== undefined ) { newSource = newSource.default; } diff --git a/spec/basic.spec.js b/spec/basic.spec.js index 14cbef6b..b2685667 100644 --- a/spec/basic.spec.js +++ b/spec/basic.spec.js @@ -3775,4 +3775,27 @@ describe("HtmlWebpackPlugin", () => { }, ); }); + + it("allows you to use empty HTML template file", (done) => { + testHtmlPlugin( + { + mode: "production", + entry: { + app: path.join(__dirname, "fixtures/index.js"), + }, + output: { + path: OUTPUT_DIR, + filename: "[name]_bundle.js", + }, + plugins: [ + new HtmlWebpackPlugin({ + template: path.join(__dirname, "fixtures/empty.html"), + }), + ], + }, + ['