Skip to content

fix(html): allow OutputHtmlOptions object for per-entry html schema - #21447

Merged
alexander-akait merged 1 commit into
webpack:mainfrom
aryanraj45:fix/html-entry-schema-object
Jul 31, 2026
Merged

alexander-akait merged 1 commit into
webpack:mainfrom
aryanraj45:fix/html-entry-schema-object

Conversation

@aryanraj45

@aryanraj45 aryanraj45 commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

This fixes a schema validation and TypeScript mismatch for the HTML entry feature.

Context: The per-entry html option inside EntryDescription and EntryDescriptionNormalized was restricted strictly to type: "boolean" in the schema (schemas/WebpackOptions.json). However, the implementation inside HtmlModulesPlugin already smoothly accepts an object to override specific HTML options at the entry level (e.g., pulling desc.html.favicon and desc.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 html to boolean | OutputHtmlOptions (using $ref: "#/definitions/OutputHtmlOptions"). This aligns the JSON schema definition with the existing capability output.html uses globally, ensuring developers can safely configure per-entry overrides.

  • Updated schemas/WebpackOptions.json to include the $ref to OutputHtmlOptions.
  • Regenerated declarations/WebpackOptions.d.ts, schemas/WebpackOptions.check.js, and types.d.ts using yarn fix:special.
  • Added a full test suite verifying html: { favicon: false }, html: { inject: "head" }, custom favicon paths, and global output.html fallbacks.

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; boolean values 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 html configuration with what output.html already supports and what the HTML plugin already reads at runtime.

Entry html on EntryDescription / EntryDescriptionNormalized is widened from boolean only to boolean | OutputHtmlOptions, so configs like html: { favicon: false } or html: { inject: "head" } pass schema validation and match TypeScript. Generated artifacts (declarations/WebpackOptions.d.ts, schema check) were refreshed via yarn fix:special; the .d.ts diff also reorders HtmlFaviconIcon / OutputHtmlOptions declarations with no semantic change.

Behavior: additive—html: true / false unchanged; 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.

Copilot AI review requested due to automatic review settings July 17, 2026 18:35
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: de0f97d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@aryanraj45
aryanraj45 force-pushed the fix/html-entry-schema-object branch from 7bf3686 to 81a02c4 Compare July 21, 2026 08:51
Copilot AI review requested due to automatic review settings July 21, 2026 08:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@alexander-akait

Copy link
Copy Markdown
Member

Let’s rebase and we can merge

@aryanraj45
aryanraj45 force-pushed the fix/html-entry-schema-object branch from 81a02c4 to de0f97d Compare July 31, 2026 10:35
@aryanraj45

Copy link
Copy Markdown
Member Author

@alexander-akait done thanks

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread declarations/WebpackOptions.d.ts
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.86%. Comparing base (a298ad8) to head (de0f97d).

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     
Flag Coverage Δ
css-parsing 25.03% <ø> (ø)
html5lib 26.45% <ø> (ø)
integration 89.35% <ø> (+<0.01%) ⬆️
test262 43.50% <ø> (ø)
unit 48.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed

codspeed Bot commented Jul 31, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 21.85%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 219 untouched benchmarks

Performance Changes

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)

Open in CodSpeed

@alexander-akait
alexander-akait merged commit 821b1c5 into webpack:main Jul 31, 2026
61 of 62 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

This PR is packaged and the instant preview is available (821b1c5).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@821b1c5
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@821b1c5
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@821b1c5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Sponsor
SponsoredKunjungi sekarang
Promo