fix(html): allow OutputHtmlOptions object for per-entry html schema - #21447
Conversation
|
7bf3686 to
81a02c4
Compare
|
Let’s rebase and we can merge |
81a02c4 to
de0f97d
Compare
|
@alexander-akait done thanks |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit de0f97d. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21447 +/- ##
=======================================
Coverage 93.85% 93.86%
=======================================
Files 622 622
Lines 75561 75561
Branches 21989 21989
=======================================
+ Hits 70920 70922 +2
+ Misses 4641 4639 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 21.85%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Memory | benchmark "future-defaults", scenario '{"name":"mode-production","mode":"production"}' |
11.3 MB | 9.3 MB | +21.85% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing aryanraj45:fix/html-entry-schema-object (de0f97d) with main (a298ad8)
|
This PR is packaged and the instant preview is available (821b1c5). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@821b1c5
yarn add -D webpack@https://pkg.pr.new/webpack@821b1c5
pnpm add -D webpack@https://pkg.pr.new/webpack@821b1c5 |

Summary
This fixes a schema validation and TypeScript mismatch for the HTML entry feature.
Context: The per-entry
htmloption insideEntryDescriptionandEntryDescriptionNormalizedwas restricted strictly totype: "boolean"in the schema (schemas/WebpackOptions.json). However, the implementation insideHtmlModulesPluginalready smoothly accepts an object to override specific HTML options at the entry level (e.g., pullingdesc.html.faviconanddesc.html.inject).Because of this mismatch, whenever a developer tried to use the object syntax (e.g.,
html: { favicon: false }), webpack would throw a schema validation error, and TypeScript definitions would flag it as an invalid type.The Fix: We widened the schema definition for entry
htmltoboolean | OutputHtmlOptions(using$ref: "#/definitions/OutputHtmlOptions"). This aligns the JSON schema definition with the existing capabilityoutput.htmluses globally, ensuring developers can safely configure per-entry overrides.schemas/WebpackOptions.jsonto include the$reftoOutputHtmlOptions.declarations/WebpackOptions.d.ts,schemas/WebpackOptions.check.js, andtypes.d.tsusingyarn fix:special.html: { favicon: false },html: { inject: "head" }, custom favicon paths, and globaloutput.htmlfallbacks.What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes. Added
test/configCases/html/output-html-per-entry-object/covering the execution and validation of per-entry object overrides.Does this PR introduce a breaking change?
No. This is purely an additive type widening;
booleanvalues continue to function exactly as before.If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
YES
Note
Low Risk
Schema and type widening only; no runtime logic changes, and boolean entry HTML options stay backward compatible.
Overview
Aligns per-entry
htmlconfiguration with whatoutput.htmlalready supports and what the HTML plugin already reads at runtime.Entry
htmlonEntryDescription/EntryDescriptionNormalizedis widened frombooleanonly toboolean | OutputHtmlOptions, so configs likehtml: { favicon: false }orhtml: { inject: "head" }pass schema validation and match TypeScript. Generated artifacts (declarations/WebpackOptions.d.ts, schema check) were refreshed viayarn fix:special; the.d.tsdiff also reordersHtmlFaviconIcon/OutputHtmlOptionsdeclarations with no semantic change.Behavior: additive—
html: true/falseunchanged; object form was previously rejected at validate time despite working in implementation.Reviewed by Cursor Bugbot for commit de0f97d. Bugbot is set up for automated code reviews on this repo. Configure here.