docs(experiments): document experiments.html and its HTML features#8243
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| <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. |
Member
There was a problem hiding this comment.
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)
399eb1d to
2db2b03
Compare
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
2 tasks
alexander-akait
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Webpack 5.107 introduces
experiments.htmlas the foundation for native HTML entry-point support in webpack 6 (tracked in #536). The flag registers thehtmlmodule type onNormalModuleFactoryand unlocks several HTML behaviors that landed in the same release:<style>tags routed through the CSS pipeline as virtualexportType: "text"modules, sourl()and@importresolve relative to the HTML file.<script src>and<link rel="modulepreload">references turned into real webpack entries, with shared runtime viadependOnfor multiple scripts on the same page, independent chunks for modulepreload, and auto-upgrade totype="module"underoutput.module.webpackIgnoremagic comment for HTML (cross-references the existing magic comments docs inapi/module-methods).Adds the entry to the TOC and a new
### experiments.htmlsection inconfiguration/experiments.mdxplaced afterexperiments.futureDefaults.Refs:
<script src>and<link rel=modulepreload>in HTML modules webpack#20949 (script src / modulepreload)Test plan
Use of AI
Drafted with Claude under human review. The contributor verified each change against the upstream webpack PR before commit.