Skip to content

docs(experiments): document experiments.html and its HTML features#8243

Merged
alexander-akait merged 2 commits into
mainfrom
docs/experiments-html
May 19, 2026
Merged

docs(experiments): document experiments.html and its HTML features#8243
alexander-akait merged 2 commits into
mainfrom
docs/experiments-html

Conversation

@bjohansebas
Copy link
Copy Markdown
Member

Summary

Webpack 5.107 introduces experiments.html as the foundation for native HTML entry-point support in webpack 6 (tracked in #536). The flag registers the html module type on NormalModuleFactory and unlocks several HTML behaviors that landed in the same release:

  • Inline <style> tags routed through the CSS pipeline as virtual exportType: "text" modules, so url() and @import resolve relative to the HTML file.
  • <script src> and <link rel="modulepreload"> references turned into real webpack entries, with shared runtime via dependOn for multiple scripts on the same page, independent chunks for modulepreload, and auto-upgrade to type="module" under output.module.
  • webpackIgnore magic comment for HTML (cross-references the existing magic comments docs in api/module-methods).

Adds the entry to the TOC and a new ### experiments.html section in configuration/experiments.mdx placed after experiments.futureDefaults.

Refs:

Test plan

  • Visual check of the new section and all subsections
  • Verify the TOC entry links correctly
  • Verify the warning admonition is visible
  • Verify all badges show "5.107.0+"

Use of AI

Drafted with Claude under human review. The contributor verified each change against the upstream webpack PR before commit.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webpack-js-org Ready Ready Preview, Comment May 19, 2026 3:05pm

Request Review


<Badge text="5.107.0+" />

Enable native HTML entry-point support. This is the foundation for handling `.html` files as first-class webpack modules without `html-webpack-plugin` or `html-loader`. The flag registers the `html` module type on `NormalModuleFactory` and unlocks the HTML behaviors described below.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I want to say it is too early write here about html-webpack-plugin, now we support only html-loader features, I think we will finish it in 5.108.0

Webpack 5.107 introduces experiments.html, the html-loader side of
native HTML module support. With the flag on, importing an HTML file
from JavaScript runs its tag references through the webpack pipeline.

What this PR documents:

- The experiments.html flag and its TOC entry.
- The JS-import-HTML usage pattern (no entry-point support yet).
- Inline <style> tags routed through the CSS pipeline as virtual
  exportType: "text" modules, so url() and @import resolve relative to
  the HTML file.
- Inline <script> tags routed through the same entry pipeline as
  <script src>: classic bodies bundle as CommonJS, type="module"
  bodies as ESM, tags rewritten to <script src="...">, auto-upgrade to
  type="module" under output.module.
- <script src> and <link rel="modulepreload"> references becoming real
  webpack entries with shared runtime via dependOn, independent
  modulepreload chunks, and type="module" auto-upgrade.
- webpackIgnore magic comment for HTML (cross-references the existing
  magic comments docs in api/module-methods).

What is explicitly NOT supported in 5.107 (called out in the warning
admonition): HTML entry points (the html-webpack-plugin part). That is
planned for the next minor release. The full story is tracked in
issue #536.

Refs:
- webpack/webpack#20902 (experiments.html flag)
- webpack/webpack#20962 (inline <style>)
- webpack/webpack#20967 (inline <script>)
- webpack/webpack#20949 (<script src> / modulepreload)
- webpack/webpack#20950 (webpackIgnore in HTML)
Webpack 5.107 supports the webpackIgnore magic comment inside HTML
modules (when experiments.html is enabled). Placing
<!-- webpackIgnore: true --> before a tag skips URL resolution for its
src/href/srcset attributes, leaving the tag untouched in the emitted
HTML. Adds a new HTML Usage section under the existing webpackIgnore
docs in api/module-methods.

Refs: webpack/webpack#20950
@alexander-akait alexander-akait merged commit 18ccc59 into main May 19, 2026
9 checks passed
@alexander-akait alexander-akait deleted the docs/experiments-html branch May 19, 2026 15:19
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.

2 participants