Skip to content

feat(html): add output.html.scriptLoading option#21200

Open
aryanraj45 wants to merge 1 commit into
webpack:mainfrom
aryanraj45:feat/html-script-loading-v2
Open

feat(html): add output.html.scriptLoading option#21200
aryanraj45 wants to merge 1 commit into
webpack:mainfrom
aryanraj45:feat/html-script-loading-v2

Conversation

@aryanraj45

@aryanraj45 aryanraj45 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds output.html.scriptLoading (auto | defer | blocking) to control how the <script> tags injected into a generated output.html page load. Default is auto: a deferred classic script, or a type="module" script when output.module is enabled (already deferred per spec). defer forces a deferred script, blocking emits a plain blocking script. Since ES module scripts are always deferred, defer/blocking have no effect under output.module and now emit a compilation warning. Part of the experiments.html roadmap, building on output.html (#21215).

What kind of change does this PR introduce?

feat

Did you add tests for your changes?

Yes — test/configCases/html/output-html-script-loading/ covers auto/defer/blocking, the empty-object fallback, ES module output, and the output.module conflict warning (warnings.js).

Does this PR introduce a breaking change?

No. output.html defaults to false, and scriptLoading defaults to auto, which preserves the prior injected-script behavior.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

The output.html.scriptLoading option should be added to the configuration docs once merged.

Use of AI

@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 063f0b9

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

@aryanraj45 aryanraj45 force-pushed the feat/html-script-loading-v2 branch 2 times, most recently from 1124d79 to 0da2f7f Compare June 20, 2026 11:16
@aryanraj45 aryanraj45 force-pushed the feat/html-script-loading-v2 branch from 0da2f7f to 063f0b9 Compare June 20, 2026 11:22
@aryanraj45 aryanraj45 marked this pull request as ready for review June 20, 2026 11:22
@aryanraj45

Copy link
Copy Markdown
Contributor Author

@alexander-akait Added scriptLoading is in auto/defer/blocking, default auto, warns on defer/blocking+output.module.
Please have a look thanks !!

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.

1 participant