Skip to content

Commit

Permalink
fix: allow bundle empty html
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Oct 17, 2024
1 parent 832e0f9 commit c984c2b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ class HtmlWebpackPlugin {
if (
typeof newSource === "object" &&
newSource.__esModule &&
newSource.default
newSource.default !== undefined
) {
newSource = newSource.default;
}
Expand Down
23 changes: 23 additions & 0 deletions spec/basic.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}),
],
},
['<script defer="defer" src="app_bundle.js'],
null,
done,
);
});
});
Empty file added spec/fixtures/empty.html
Empty file.

0 comments on commit c984c2b

Please sign in to comment.