GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(esm): bake analyzable references per asset, and drop the asset wrapper no one reads by alexander-akait · Pull Request #21688 · webpack/webpack

Conversation

@alexander-akait

@alexander-akait alexander-akait commented Aug 11, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

Follow-up to #21680. Analyzable ESM output kept the runtime form in a long list of cases that turned out to share one cause: a reserved name had a fixed shape (prefix + chunk filename + tail), and the gate deciding whether one could be reserved asked about the whole compilation rather than the asset the name is written into. Both are now per-asset, which settles a hashed chunkFilename, a [fullhash] or function public path, a re-encoded digest and a two-depth reference in a plain mode: "development" build. On top of that, an asset whose every JavaScript consumer is a new URL() no longer gets a module.exports = __webpack_require__.p + name wrapper that nothing reads.

Two of the commits are fixes for references that resolved somewhere the runtime form does not — a relative output.publicPath produced a specifier a chunk below the output root resolved one directory too deep (test/configCases/module/public-path carried a resolveModule shim for exactly that, now removed), and an entry baseUri was ignored outright.

What kind of change does this PR introduce?

feat

Did you add tests for your changes?

Yes. New test/configCases/analyzable/: asset-url-matrix (one reference read from two depths under eight shapes of public path), asset-wrapper-retention, asset-url-relative-public-path, asset-url-templated-public-path, asset-url-function-public-path, asset-url-shared-depths, asset-url-base-uri, asset-url-wrapperless, import-relative-public-path, shared-module-chunk, stand-in-lookalike; test/configCases/wasm/sync-constant-public-path; extra configs on the existing wasm cases; two more bailout reasons in statsCases/analyzable-esm-fallbacks; round-trip markers; and test/AnalyzableChunkHashPlugin.unittest.js for the payload alphabet and the digest rule no build can reach. Each behavioural change was verified failing on the unmodified lib/ first.

Does this PR introduce a breaking change?

No. Output changes only where a reference already had to be analyzable — cases that previously fell back now bake, and one that previously baked a wrong relative URL now bakes the right one.

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

n/a — no new option. What still keeps the runtime form is reported per module in stats.optimizationBailout.

Use of AI

AI was used. Claude Code implemented the changes and tests under my direction and review: I set the scope, it investigated each fallback, proposed and wrote the patches, and each behavioural claim was checked against a build (failing test first, then passing) rather than accepted from the model. I reviewed every diff before it was committed.


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Improved asset and WebAssembly URL generation across relative, rooted, CDN, templated, and function-based public paths.
    • More URLs and dynamic imports are resolved directly in generated bundles, including hashed filenames and nested chunks.
    • Reduces runtime URL handling when paths are statically known.
    • Improves handling of asset wrappers used only when necessary.
  • Bug Fixes

    • Corrected resolution across entry paths, chunk depths, shared modules, workers, and deferred filenames.
  • Tests

    • Expanded coverage for URL generation, hashing, WebAssembly, workers, and fallback scenarios.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
alexander-akait added 8 commits August 11, 2026 22:31
@alexander-akait @claude
feat(esm): bake analyzable asset urls per depth, hash and function pu…
1787cf9
…blic path

An asset `new URL` now goes through the same specifier builder as a chunk
reference, so it bakes from chunks at several output depths, behind a public
path carrying `[fullhash]` in any digest, and behind a function public path
whose answer does not move with the compilation hash.

The deferral gate asks the names the emitted chunks actually carry rather than
the `output` templates, so a content-named template nothing is emitted under no
longer rules the rewrite out; the two wasm gates that refused silently now
record why.
@alexander-akait @claude
fix(esm): resolve a relative public path against the output root when…
da60d95
… baking

The runtime resolves `__webpack_require__.p + name` against
`__webpack_require__.b`, the output root — not against the chunk the reference
sits in. A public path that needs a base therefore follows the `../` path back
to that root instead of being baked as the whole specifier, which a chunk below
the root resolved one directory too deep.
@alexander-akait @claude
fix(esm): keep a baked reference pointing where the runtime form does
d282fb7
Three references resolved somewhere the runtime form does not:

- A relative `output.publicPath` was baked as the whole specifier of a chunk
  `import()`, which a chunk below the output root then resolved one directory
  too deep — `module/public-path` needed a `resolveModule` shim to reach its
  chunks at all. It now follows the `../` path back to the root, as the asset
  form already does.
- An entry `baseUri` replaces that root, and no literal read from its own chunk
  shares it, so a public path that needs a base keeps the runtime form.
- A function `output.publicPath` is called for its value before the
  absolute-URL check a wasm `fetch` loader makes, instead of failing it for not
  being a string.
@alexander-akait @claude
feat(esm): defer any name, not one shaped like a stand-in
077c6b1
A reserved name was a fixed prefix, chunk filename and tail, where the prefix was
either literal text or one of two recipes. It is now an ordered list of parts, so
what the deferred pass can spell no longer depends on where in a name it falls.

Three references that fell back now bake:

- `[fullhash:<digest>]` in `webassemblyModuleFilename`. The name resolves at code
  generation with everything but the compilation hash — a placeholder nothing
  answers stays in the string — and `getPath` spells the rest once it exists.
- A function `output.publicPath` whose value moves with the hash: it is called
  again by the deferred pass, as `PublicPathRuntimeModule` calls it.
- A relative public path carrying such a digest, which needs both the `../` path
  back to the output root and a template only the deferred pass can resolve.
@alexander-akait @claude
feat(esm): ask the asset a stand-in lands in, not the whole compilation
b589662
Reserving a name rewrites the asset it is written into after that asset's own
content hash was taken, so `optimization.realContentHash` is what repairs it.
The gate asked whether any emitted javascript was named by its content, which
refused a reference in a plainly named chunk over a hash somewhere else entirely.
It now asks the chunks the reference is actually emitted into.

A hashed `chunkFilename`, a `[fullhash]` public path, a hashed worker chunk and
a two-depth reference all bake in a `mode: "development"` build now, where
`realContentHash` is off by default.
@alexander-akait @claude
feat(esm): ask whether the chunk has javascript, not what kind of mod…
1bd17ba
…ules it holds

`.ei` always performs the import, where `.e` reaches the javascript loader only
when there is javascript to load — so what rules a chunk out is this compilation
emitting none for it. That was approximated by refusing any chunk holding a
module federation module, which also refused a chunk whose javascript is emitted
right here and merely shares a module. Verified from the other side: dropping the
gate entirely breaks the container cases on a remote chunk this build never
emits, and the narrower one keeps them passing.
@alexander-akait @claude
feat: settle three more analyzable references, and stop emitting a wr…
424e574
…apper for them

- An asset whose every javascript consumer is a `new URL()` needs no
  `module.exports = .p + name` wrapper: each consumer names the file itself. The
  wrapper was only dropped behind an absolute public path, where one url serves
  every chunk; it is now dropped whenever it is read by no one, and the reference
  that cannot bake concatenates the same thing inline. That takes the publicPath
  runtime module out of bundles whose only use of it was this.
- An entry `baseUri` replaces the output root an asset url resolves against. An
  absolute one settles the whole url here, so it is baked rather than deferred to
  the runtime; only entries disagreeing on a base leave nothing to bake.
- The sync WebAssembly loader builds its binary's name at runtime either way, but
  a public path that never changes is inlined instead of read from the global.
@alexander-akait @claude
test(esm): pin what analyzable output bakes, drops and refuses to guess
5197ca9
- `asset-url-matrix` reads one asset reference from chunks at two depths under
  eight shapes of public path and states the exact specifier each bakes, so a
  change to how a base is composed shows up as a diff rather than a broken url.
- `asset-wrapper-retention` covers the other side of dropping the asset wrapper:
  a plain import, `url: "relative"` and a reassigned public path each still read
  it, and each keeps it.
- `stand-in-lookalike` writes seven payloads shaped like a reserved name into
  user source — unreadable base64, a non-array, a bad tuple, an unknown kind, a
  wrong value type, an unknown chunk id — and asserts every one reaches the
  bundle as written while a real reference beside them is filled in.
- The stats case gains the `eval` devtool and a worker on another chunk loader,
  so both bailout reasons are read rather than assumed.
- Round-trip markers on the single-config asset and sharing cases, and a unit
  test for the payload alphabet and the digest rule no build can reach.
@changeset-bot

changeset-bot Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7e4190f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack Minor

Not sure what this means? Click here to learn what changesets are.

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added area: parser JavaScript parsing and dependency analysis (lib/javascript, lib/dependencies) area: runtime Emitted runtime and chunk loading across targets (lib/runtime, lib/web, lib/node, lib/esm) area: types types.d.ts, JSDoc annotations, hand-maintained declarations labels Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "tools"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9baf5cc0-102e-410e-b85d-4f017d918c2f

📥 Commits

Reviewing files that changed from the base of the PR and between 6538953 and e28d2a6.

📒 Files selected for processing (2)
  • lib/RuntimeTemplate.js
  • test/RuntimeTemplate.unittest.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • webpack/schema-utils (auto-detected)
  • webpack/tapable (auto-detected)
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/RuntimeTemplate.js

📝 Walkthrough

Walkthrough

Summary

Webpack now resolves analyzable asset, chunk, WebAssembly, and worker URLs through structured deferred specifiers. Tests cover public paths, base URIs, hashes, chunk depth, wrapper removal, and fallback behavior.

Changes

Analyzable URLs and deferred specifiers

Layer / File(s) Summary
Runtime asset URL resolution
lib/RuntimeTemplate.js, lib/asset/AssetGenerator.js, lib/dependencies/URLDependency.js
Asset URLs now account for emitted assets, wrapper usage, entry baseUri, public-path forms, function-valued paths, and deferred hashes.
Deferred chunk specifier resolution
lib/RuntimeTemplate.js, lib/esm/AnalyzableChunkHashPlugin.js
Chunk references now use ordered typed parts and resolve templates, public paths, undo paths, and chunk filenames during deferred processing.
WebAssembly public-path handling
lib/RuntimeTemplate.js, lib/web/FetchCompileWasmPlugin.js, lib/*Wasm*.js
WebAssembly loading uses analyzable, constant, or runtime public paths. Capability checks use the unified supportsAnalyzable API.
Asset URL integration coverage
test/configCases/analyzable/asset-url-*/, test/configCases/analyzable/asset-wrapper-retention/*
Tests cover base URIs, relative and templated paths, function paths, chunk depth, wrapperless assets, and wrapper retention.
Deferred resolution and fallback coverage
test/AnalyzableChunkHashPlugin.unittest.js, test/configCases/analyzable/*, test/configCases/worker/*, test/statsCases/analyzable-esm-fallbacks/*, .changeset/024-analyzable-asset-urls-and-function-paths.md
Tests cover deferred hashes, hashed chunks, workers, shared chunks, malformed stand-ins, fallback cases, and the release note.

Possibly related PRs

  • webpack/webpack#21653: This PR extends its analyzable ESM infrastructure for hashed and function-based URL resolution.
  • webpack/webpack#21669: Both PRs modify analyzable output handling in runtime templates, dependencies, chunk hashing, and WebAssembly code.
  • webpack/webpack#21680: Both PRs modify analyzable URL generation and deferred specifier resolution for paths and hashes.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the required feat(esm): format and accurately describes per-asset analyzable references and asset-wrapper removal.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@7299185
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@7299185
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@7299185
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.60627% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.52%. Comparing base (075b1ce) to head (7e4190f).

Files with missing lines Patch % Lines
lib/RuntimeTemplate.js 97.94% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #21688   +/-   ##
=======================================
  Coverage   94.51%   94.52%           
=======================================
  Files         631      631           
  Lines       82402    82498   +96     
  Branches    24422    24458   +36     
=======================================
+ Hits        77885    77983   +98     
+ Misses       4517     4515    -2     
Flag Coverage Δ
css-parsing 26.57% <5.05%> (-0.03%) ⬇️
html5lib 30.95% <5.05%> (-0.03%) ⬇️
integration 88.23% <98.60%> (+0.01%) ⬆️
test262 51.65% <19.61%> (-0.06%) ⬇️
unit 54.55% <18.28%> (+0.03%) ⬆️

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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Generated code size

Comparing 7e4190f merged into 075b1ce against 075b1ce. Merging this PR will change the code webpack generates.

Changed New Deleted Unchanged Raw change
Cases 19 13 0 1552 🔴 ↑ +319.93 KiB
Assets 36 112 3 6118 🔴 ↑ +319.93 KiB
Runtimes 15 39 0 1918 —
151 asset(s) changed size, biggest 20 by raw change
Asset Before After Change Gzip (9) Brotli (11) Zstd (19)
➕ analyzable/shared-module-chunk bundle0.mjs — 21.37 KiB +21.37 KiB (new) new new new
➕ wasm/analyzable-templated-url-public-path 3/bundle3.mjs — 12.26 KiB +12.26 KiB (new) new new new
➕ wasm/analyzable-templated-url-public-path 4/bundle4.mjs — 12.23 KiB +12.23 KiB (new) new new new
➕ wasm/analyzable-templated-url-public-path 5/bundle5.mjs — 12.15 KiB +12.15 KiB (new) new new new
➕ wasm/sync-constant-public-path bundle0.mjs — 11.47 KiB +11.47 KiB (new) new new new
➕ wasm/analyzable-runtime-scope main.mjs — 9.80 KiB +9.80 KiB (new) new new new
➕ analyzable/shared-depths-import-fallback bundle0.mjs — 9.75 KiB +9.75 KiB (new) new new new
➕ analyzable/asset-url-wrapperless bundle0.mjs — 9.39 KiB +9.39 KiB (new) new new new
➖ analyzable/shared-depths-import-fallback main.[hash].mjs 9.33 KiB — -9.33 KiB (gone) gone gone gone
➕ analyzable/stand-in-lookalike bundle0.mjs — 9.04 KiB +9.04 KiB (new) new new new
➕ analyzable/asset-url-relative-public-path 2/bundle2.mjs — 8.14 KiB +8.14 KiB (new) new new new
➕ analyzable/asset-url-relative-public-path 1/bundle1.mjs — 8.04 KiB +8.04 KiB (new) new new new
➕ analyzable/asset-url-relative-public-path 0/bundle0.mjs — 8.04 KiB +8.04 KiB (new) new new new
➕ analyzable/asset-url-shared-depths bundle0.mjs — 8.03 KiB +8.03 KiB (new) new new new
➕ analyzable/asset-url-matrix 7/bundle7.mjs — 7.74 KiB +7.74 KiB (new) new new new
➕ analyzable/asset-url-matrix 6/bundle6.mjs — 7.72 KiB +7.72 KiB (new) new new new
➕ analyzable/asset-url-matrix 5/bundle5.mjs — 7.70 KiB +7.70 KiB (new) new new new
➕ analyzable/asset-url-matrix 3/bundle3.mjs — 7.69 KiB +7.69 KiB (new) new new new
➕ analyzable/asset-url-matrix 4/bundle4.mjs — 7.69 KiB +7.69 KiB (new) new new new
➕ analyzable/asset-url-matrix 1/bundle1.mjs — 7.67 KiB +7.67 KiB (new) new new new
… 131 more asset(s), see the uploaded report
54 runtime(s) changed which runtime modules they carry, biggest 20 by number moved
Runtime Modules Added Removed
➕ analyzable/shared-module-chunk main 0 → 8 consumes, define property getters, ensure chunk, get javascript chunk filename, hasOwnProperty shorthand, import chunk loading, make namespace object, sharing —
➕ wasm/analyzable-templated-url-public-path 4/main 0 → 8 async module, define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object, publicPath, wasm loading —
➕ wasm/analyzable-runtime-scope main 0 → 7 async module, define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object, wasm loading —
➕ wasm/analyzable-templated-url-public-path 3/main 0 → 7 async module, define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object, wasm loading —
➕ wasm/analyzable-templated-url-public-path 5/main 0 → 7 async module, define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object, wasm loading —
➕ analyzable/asset-url-wrapperless main 0 → 6 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object, publicPath —
➕ wasm/sync-constant-public-path main 0 → 6 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object, wasm chunk loading —
➕ analyzable/asset-url-base-uri 1/main 0 → 5 define property getters, hasOwnProperty shorthand, import chunk loading, make namespace object, publicPath —
➕ analyzable/asset-url-base-uri 1/other 0 → 5 define property getters, hasOwnProperty shorthand, import chunk loading, make namespace object, publicPath —
➕ analyzable/asset-url-base-uri 2/main 0 → 5 define property getters, hasOwnProperty shorthand, import chunk loading, make namespace object, publicPath —
➕ analyzable/asset-url-base-uri 2/other 0 → 5 define property getters, hasOwnProperty shorthand, import chunk loading, make namespace object, publicPath —
➕ analyzable/asset-url-function-public-path 3/main 0 → 5 define property getters, hasOwnProperty shorthand, import chunk loading, make namespace object, publicPath —
➕ analyzable/asset-url-matrix 0/main 0 → 5 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object —
➕ analyzable/asset-url-matrix 1/main 0 → 5 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object —
➕ analyzable/asset-url-matrix 2/main 0 → 5 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object —
➕ analyzable/asset-url-matrix 3/main 0 → 5 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object —
➕ analyzable/asset-url-matrix 4/main 0 → 5 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object —
➕ analyzable/asset-url-matrix 5/main 0 → 5 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object —
➕ analyzable/asset-url-matrix 6/main 0 → 5 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object —
➕ analyzable/asset-url-matrix 7/main 0 → 5 define property getters, ensure chunk, hasOwnProperty shorthand, import chunk loading, make namespace object —
… 34 more runtime(s), see the uploaded report

Built test/configCases with the defaults a user gets: 1584 case(s), 6266 asset(s), 40 emitted nothing.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed Aug 11, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (4)
test/configCases/wasm/sync-constant-public-path/webpack.config.js (1)

3-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten this comment.

Keep the rationale in at most two short lines.

Proposed change
-// The binary's name is built at runtime from the module id either way, but the public
-// path in front of it is settled — so it is inlined instead of read from the global,
-// and the runtime module that would set that global is not emitted at all.
+// Inline the settled public path and omit the public-path runtime module.

As per coding guidelines, comments must generally use one line and no more than two short lines. As per path instructions, comments must be at most two short lines and add non-obvious information.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/configCases/wasm/sync-constant-public-path/webpack.config.js` around
lines 3 - 5, Shorten the comment above the public-path configuration to no more
than two brief lines, preserving only the non-obvious rationale that the public
path is inlined and its global-setting runtime module is omitted.

Sources: Coding guidelines, Path instructions

lib/esm/AnalyzableChunkHashPlugin.js (1)

56-64: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten the new comments.

Keep each comment to no more than two short lines. Preserve the JSDoc type declarations, but remove or condense the detailed narrative.

As per coding guidelines, “Keep comments as short as possible, generally one line and no more than two short lines.”

Also applies to: 222-224

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/esm/AnalyzableChunkHashPlugin.js` around lines 56 - 64, Shorten the JSDoc
descriptions for the `"literal"`, `"undo"`, `"template"`, `"publicPath"`, and
`"chunk"` variants in the AnalyzableChunkHashPlugin comments, keeping each to no
more than two short lines. Preserve the existing type declarations and apply the
same concise wording to the additional commented section around the referenced
entries.

Sources: Coding guidelines, Path instructions

test/statsCases/analyzable-esm-fallbacks/webpack.config.js (1)

79-82: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reduce these test comments to two short lines.

  • test/statsCases/analyzable-esm-fallbacks/webpack.config.js#L79-L82: Keep only the fallback cause and outcome.
  • test/configCases/analyzable/dynamic-import-contenthash/webpack.config.js#L14-L16: Keep only the deferred-name and rewrite-invalidation facts.
  • test/configCases/module/public-path/test.config.js#L15-L17: Keep only the absolute-URL routing rule.

As per coding guidelines, test/**/*.js comments must generally use no more than two short lines. As per path instructions, test/** comments must be at most two short lines.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/statsCases/analyzable-esm-fallbacks/webpack.config.js` around lines 79 -
82, Shorten the comments at
test/statsCases/analyzable-esm-fallbacks/webpack.config.js lines 79-82,
test/configCases/analyzable/dynamic-import-contenthash/webpack.config.js lines
14-16, and test/configCases/module/public-path/test.config.js lines 15-17 to no
more than two short lines each. Retain only the fallback cause and outcome at
the first site, the deferred-name and rewrite-invalidation facts at the second,
and the absolute-URL routing rule at the third.

Sources: Coding guidelines, Path instructions

test/configCases/analyzable/shared-depths-import-fallback/webpack.config.js (1)

3-7: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten the explanatory comments.

Keep each comment to at most two short lines.

  • test/configCases/analyzable/shared-depths-import-fallback/webpack.config.js#L3-L7: Reduce the comment to the required length.
  • test/configCases/worker/worker-shared-depths-runtime-path/webpack.config.js#L3-L5: Reduce the comment to the required length.

As per coding guidelines and path instructions, comments must be no more than two short lines.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/configCases/analyzable/shared-depths-import-fallback/webpack.config.js`
around lines 3 - 7, Shorten the explanatory comment in
test/configCases/analyzable/shared-depths-import-fallback/webpack.config.js
lines 3-7 to no more than two short lines while preserving its essential
rationale. Apply the same comment-length reduction in
test/configCases/worker/worker-shared-depths-runtime-path/webpack.config.js
lines 3-5, also keeping it within two short lines.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/024-analyzable-asset-urls-and-function-paths.md:
- Line 5: Shorten the changeset sentence to 80 characters or fewer while keeping
it as one capitalized imperative sentence describing the same change and ending
with a period.

In `@lib/asset/AssetGenerator.js`:
- Around line 825-832: Shorten the changed comments to no more than two short
lines each: in lib/asset/AssetGenerator.js lines 825-832 retain only the
wrapper-selection constraint; in
test/configCases/analyzable/asset-url-matrix/webpack.config.js lines 3-6 retain
only the output-root resolution constraint; and in
test/configCases/analyzable/asset-wrapper-retention/webpack.config.js lines 3-5
retain only the wrapper-retention constraint. No code behavior changes are
needed.

In `@lib/dependencies/URLDependency.js`:
- Around line 72-74: Shorten the comments at lib/dependencies/URLDependency.js
lines 72-74 and 249-251, and
test/configCases/analyzable/asset-url-wrapperless/webpack.config.js lines 3-6,
preserving their intended explanations while limiting each comment to one line
or no more than two short lines.

In `@lib/esm/AnalyzableChunkHashPlugin.js`:
- Around line 107-113: Update the decoded-part validation in the relevant
payload parser to require string values for literal, undo, template, and
publicPath kinds, while permitting numbers only for chunk. Preserve rejection of
unknown kinds and malformed pairs, and add a lookalike regression case covering
an encoded template part with a numeric value so it remains unchanged.

In `@lib/RuntimeTemplate.js`:
- Around line 691-709: Update RuntimeTemplate._entryBaseUri to treat an omitted
entryOptions.baseUri as a conflict whenever another entry defines a baseUri,
returning the runtime form rather than the configured base; preserve the
existing result when all entries omit or consistently define baseUri. Add a
regression test covering a shared module used by entries with and without
baseUri.

In `@test/configCases/analyzable/asset-url-wrapperless/index.js`:
- Around line 30-36: Extend the assertions in the wrapperless asset test to also
read nested/deep.*.mjs, checking that source does not contain wrapper and that
the inline public-path asset import is present. Keep the existing bundle0 and
flat.* coverage unchanged while including the nested chunk in both
generated-source assertions.

---

Nitpick comments:
In `@lib/esm/AnalyzableChunkHashPlugin.js`:
- Around line 56-64: Shorten the JSDoc descriptions for the `"literal"`,
`"undo"`, `"template"`, `"publicPath"`, and `"chunk"` variants in the
AnalyzableChunkHashPlugin comments, keeping each to no more than two short
lines. Preserve the existing type declarations and apply the same concise
wording to the additional commented section around the referenced entries.

In `@test/configCases/analyzable/shared-depths-import-fallback/webpack.config.js`:
- Around line 3-7: Shorten the explanatory comment in
test/configCases/analyzable/shared-depths-import-fallback/webpack.config.js
lines 3-7 to no more than two short lines while preserving its essential
rationale. Apply the same comment-length reduction in
test/configCases/worker/worker-shared-depths-runtime-path/webpack.config.js
lines 3-5, also keeping it within two short lines.

In `@test/configCases/wasm/sync-constant-public-path/webpack.config.js`:
- Around line 3-5: Shorten the comment above the public-path configuration to no
more than two brief lines, preserving only the non-obvious rationale that the
public path is inlined and its global-setting runtime module is omitted.

In `@test/statsCases/analyzable-esm-fallbacks/webpack.config.js`:
- Around line 79-82: Shorten the comments at
test/statsCases/analyzable-esm-fallbacks/webpack.config.js lines 79-82,
test/configCases/analyzable/dynamic-import-contenthash/webpack.config.js lines
14-16, and test/configCases/module/public-path/test.config.js lines 15-17 to no
more than two short lines each. Retain only the fallback cause and outcome at
the first site, the deferred-name and rewrite-invalidation facts at the second,
and the absolute-URL routing rule at the third.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 14f3c12b-9c39-442d-9dbe-0af3565bcc70

📥 Commits

Reviewing files that changed from the base of the PR and between 075b1ce and 5197ca9.

⛔ Files ignored due to path filters (2)
  • test/statsCases/analyzable-esm-fallbacks/__snapshots__/StatsTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**
  • types.d.ts is excluded by !types.d.ts
📒 Files selected for processing (89)
  • .changeset/024-analyzable-asset-urls-and-function-paths.md
  • lib/RuntimeTemplate.js
  • lib/asset/AssetGenerator.js
  • lib/dependencies/URLDependency.js
  • lib/esm/AnalyzableChunkHashPlugin.js
  • lib/web/FetchCompileWasmPlugin.js
  • test/AnalyzableChunkHashPlugin.unittest.js
  • test/configCases/analyzable/asset-url-base-uri/asset.txt
  • test/configCases/analyzable/asset-url-base-uri/index.js
  • test/configCases/analyzable/asset-url-base-uri/other.js
  • test/configCases/analyzable/asset-url-base-uri/shared.js
  • test/configCases/analyzable/asset-url-base-uri/test.config.js
  • test/configCases/analyzable/asset-url-base-uri/webpack.config.js
  • test/configCases/analyzable/asset-url-function-public-path/asset.txt
  • test/configCases/analyzable/asset-url-function-public-path/index.js
  • test/configCases/analyzable/asset-url-function-public-path/webpack.config.js
  • test/configCases/analyzable/asset-url-matrix/asset.txt
  • test/configCases/analyzable/asset-url-matrix/deep.js
  • test/configCases/analyzable/asset-url-matrix/flat.js
  • test/configCases/analyzable/asset-url-matrix/index.js
  • test/configCases/analyzable/asset-url-matrix/webpack.config.js
  • test/configCases/analyzable/asset-url-relative-public-path/asset.txt
  • test/configCases/analyzable/asset-url-relative-public-path/deep.js
  • test/configCases/analyzable/asset-url-relative-public-path/flat.js
  • test/configCases/analyzable/asset-url-relative-public-path/index.js
  • test/configCases/analyzable/asset-url-relative-public-path/shared.js
  • test/configCases/analyzable/asset-url-relative-public-path/webpack.config.js
  • test/configCases/analyzable/asset-url-shared-depths/asset.txt
  • test/configCases/analyzable/asset-url-shared-depths/deep.js
  • test/configCases/analyzable/asset-url-shared-depths/flat.js
  • test/configCases/analyzable/asset-url-shared-depths/index.js
  • test/configCases/analyzable/asset-url-shared-depths/roundTrip.js
  • test/configCases/analyzable/asset-url-shared-depths/shared.js
  • test/configCases/analyzable/asset-url-shared-depths/webpack.config.js
  • test/configCases/analyzable/asset-url-templated-public-path/asset.txt
  • test/configCases/analyzable/asset-url-templated-public-path/index.js
  • test/configCases/analyzable/asset-url-templated-public-path/webpack.config.js
  • test/configCases/analyzable/asset-url-wrapperless/asset.txt
  • test/configCases/analyzable/asset-url-wrapperless/deep.js
  • test/configCases/analyzable/asset-url-wrapperless/flat.js
  • test/configCases/analyzable/asset-url-wrapperless/index.js
  • test/configCases/analyzable/asset-url-wrapperless/shared.js
  • test/configCases/analyzable/asset-url-wrapperless/webpack.config.js
  • test/configCases/analyzable/asset-wrapper-retention/asset.txt
  • test/configCases/analyzable/asset-wrapper-retention/index-override.js
  • test/configCases/analyzable/asset-wrapper-retention/index-plain.js
  • test/configCases/analyzable/asset-wrapper-retention/index.js
  • test/configCases/analyzable/asset-wrapper-retention/plain-import.js
  • test/configCases/analyzable/asset-wrapper-retention/url-only.js
  • test/configCases/analyzable/asset-wrapper-retention/webpack.config.js
  • test/configCases/analyzable/dynamic-import-contenthash/index.js
  • test/configCases/analyzable/dynamic-import-contenthash/webpack.config.js
  • test/configCases/analyzable/function-chunk-filename/webpack.config.js
  • test/configCases/analyzable/hashed-chunk-filename/webpack.config.js
  • test/configCases/analyzable/import-relative-public-path/index.js
  • test/configCases/analyzable/import-relative-public-path/lazy.js
  • test/configCases/analyzable/import-relative-public-path/mid.js
  • test/configCases/analyzable/import-relative-public-path/webpack.config.js
  • test/configCases/analyzable/shared-depths-import-fallback/index.js
  • test/configCases/analyzable/shared-depths-import-fallback/test.config.js
  • test/configCases/analyzable/shared-depths-import-fallback/webpack.config.js
  • test/configCases/analyzable/shared-module-chunk/index.js
  • test/configCases/analyzable/shared-module-chunk/lazy.js
  • test/configCases/analyzable/shared-module-chunk/lib.js
  • test/configCases/analyzable/shared-module-chunk/roundTrip.js
  • test/configCases/analyzable/shared-module-chunk/webpack.config.js
  • test/configCases/analyzable/stand-in-lookalike/index.js
  • test/configCases/analyzable/stand-in-lookalike/lazy.js
  • test/configCases/analyzable/stand-in-lookalike/lookalikes.js
  • test/configCases/analyzable/stand-in-lookalike/webpack.config.js
  • test/configCases/analyzable/templated-public-path/webpack.config.js
  • test/configCases/module/public-path/test.config.js
  • test/configCases/wasm/analyzable-fullhash-filename/webpack.config.js
  • test/configCases/wasm/analyzable-templated-url-public-path/index.js
  • test/configCases/wasm/analyzable-templated-url-public-path/webpack.config.js
  • test/configCases/wasm/sync-constant-public-path/index.js
  • test/configCases/wasm/sync-constant-public-path/module.js
  • test/configCases/wasm/sync-constant-public-path/wasm.wat
  • test/configCases/wasm/sync-constant-public-path/webpack.config.js
  • test/configCases/worker/worker-module-hashed/index.js
  • test/configCases/worker/worker-module-hashed/webpack.config.js
  • test/configCases/worker/worker-shared-depths-runtime-path/index.js
  • test/configCases/worker/worker-shared-depths-runtime-path/webpack.config.js
  • test/statsCases/analyzable-esm-fallbacks/asset.txt
  • test/statsCases/analyzable-esm-fallbacks/index-eval.js
  • test/statsCases/analyzable-esm-fallbacks/index-worker.js
  • test/statsCases/analyzable-esm-fallbacks/test.config.js
  • test/statsCases/analyzable-esm-fallbacks/webpack.config.js
  • test/statsCases/analyzable-esm-fallbacks/worker.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • webpack/schema-utils (auto-detected)
  • webpack/tapable (auto-detected)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread .changeset/024-analyzable-asset-urls-and-function-paths.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/asset/AssetGenerator.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/dependencies/URLDependency.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/esm/AnalyzableChunkHashPlugin.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/RuntimeTemplate.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/configCases/analyzable/asset-url-wrapperless/index.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
fix(esm): keep the asset wrapper unless something is known to have re…
399a9ba
…placed it

Dropping it was decided by `jsWrapperUnused`, but the return that acted on it read
only "neither javascript nor url was asked for" — which is also what an origin of
some third kind leaves behind. A lazy-compilation proxy is one, and its asset lost
the wrapper it still required (`HotTestCases asset-modules-source`).

Also from review:
- An entry that sets no `baseUri` disagrees with one that does. The loop skipped it,
  so a module they share baked the other entry's base into a url that entry resolves
  against the output root instead.
- A reserved name's parts take a number only for a chunk id. A `["template", 0]`
  payload reached `getPath` as a number and failed the build a source string was
  only supposed to pass through.
@codspeed

codspeed Bot commented Aug 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Merging this PR will regress 2 benchmarks

⚠️ 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

⚡ 2 improved benchmarks
❌ 2 regressed benchmarks
✅ 306 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory benchmark "devtool-eval", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 471.5 KB 942.5 KB -49.97%
❌ Memory benchmark "css-modules", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 753.3 KB 1,230.4 KB -38.78%
⚡ Memory benchmark "many-modules-esm", scenario '{"name":"mode-development","mode":"development"}' 2,297.6 KB 885.3 KB ×2.6
⚡ Memory benchmark "concatenate-modules", scenario '{"name":"mode-development","mode":"development"}' 8.3 MB 5.5 MB +50.19%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feat/analyzable-asset-and-path-specifiers (7e4190f) with main (075b1ce)

Open in CodSpeed
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alexander-akait added 2 commits August 12, 2026 07:59
@alexander-akait
test(esm): unit-cover the analyzable stand-in codec
d46cbd9
The lookalike payloads the deferred pass must refuse are driven through a
real build, which cannot state what each one spells. Hold them as json both
layers read, and pin the codec's round trip, its rejections and the
compilation-hash stand-in directly.
@alexander-akait
refactor(esm): ask one question about analyzable output
6538953
Four predicates asked the same thing in four shapes, each repeating the
output.module and public-path-override checks. Fold them into
supportsAnalyzable(form), keep the per-form parts private, and record the
override bailout for every form rather than only for a chunk import.
@github-actions github-actions Bot added the area: wasm WebAssembly modules (lib/wasm-*) label Aug 12, 2026
coderabbitai[bot]
coderabbitai Bot reviewed Aug 12, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
lib/RuntimeTemplate.js (1)

350-376: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten the new narrative comments.

Lines 351-362 and 369-376 exceed two short lines. Keep the JSDoc tags and only the non-obvious contract details.

As per coding guidelines, “comments must be at most two short lines and add non-obvious information.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/RuntimeTemplate.js` around lines 350 - 376, The new narrative comments in
supportsAnalyzable are too verbose; shorten the introductory prose and inline
explanatory comments to at most two short lines each. Preserve the JSDoc tags
and retain only non-obvious contract details, including the supported forms and
bailout conditions.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/RuntimeTemplate.js`:
- Around line 368-395: Use one runtime-scoped wasm capability decision so URL
arguments, baked URLs, hash requirements, and runtime-module signatures cannot
disagree. In lib/RuntimeTemplate.js:368-395, expose or standardize the check
against the generated runtime module’s runtime; apply it in
lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js:75-86 and :247-258,
lib/wasm-async/AsyncWasmCompileRuntimeModule.js:69-85, and
lib/wasm-async/AsyncWasmLoadingRuntimeModule.js:70-86. Align the same decision
in lib/node/ReadFileCompileAsyncWasmPlugin.js:67-69, :138-145, and :175-182;
lib/wasm-async/UniversalCompileAsyncWasmPlugin.js:69-71; and
lib/web/FetchCompileAsyncWasmPlugin.js:84-113 and :131-160.

---

Nitpick comments:
In `@lib/RuntimeTemplate.js`:
- Around line 350-376: The new narrative comments in supportsAnalyzable are too
verbose; shorten the introductory prose and inline explanatory comments to at
most two short lines each. Preserve the JSDoc tags and retain only non-obvious
contract details, including the supported forms and bailout conditions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: eec26f14-7e3e-4fce-91e5-608cd3b16347

📥 Commits

Reviewing files that changed from the base of the PR and between d46cbd9 and 6538953.

⛔ Files ignored due to path filters (1)
  • types.d.ts is excluded by !types.d.ts
📒 Files selected for processing (12)
  • lib/RuntimeTemplate.js
  • lib/asset/AssetGenerator.js
  • lib/dependencies/URLDependency.js
  • lib/dependencies/WorkerDependency.js
  • lib/dependencies/WorkletDependency.js
  • lib/node/ReadFileCompileAsyncWasmPlugin.js
  • lib/wasm-async/AsyncWasmCompileRuntimeModule.js
  • lib/wasm-async/AsyncWasmLoadingRuntimeModule.js
  • lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js
  • lib/wasm-async/UniversalCompileAsyncWasmPlugin.js
  • lib/web/FetchCompileAsyncWasmPlugin.js
  • lib/web/FetchCompileWasmPlugin.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • webpack/schema-utils (auto-detected)
  • webpack/tapable (auto-detected)
🚧 Files skipped from review as they are similar to previous changes (3)
  • lib/web/FetchCompileWasmPlugin.js
  • lib/asset/AssetGenerator.js
  • lib/dependencies/URLDependency.js

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/RuntimeTemplate.js Outdated
Comment on lines +368 to +395
supportsAnalyzable(form, chunkGraph, module) {
// Analyzable output is ESM output — anything else is a different feature, not a
// limitation of this one, so it is not worth a bailout.
if (!this.isModule() || !this.supportsEcmaScriptModuleSyntax()) {
return false;
}
// A runtime `__webpack_public_path__` override cannot reach a baked literal, so
// keep the runtime form that reads `__webpack_require__.p` — but only where the
// reassignment reaches, since `.p` belongs to a runtime.
if (
APIPlugin.runtimeUsesPublicPathOverride(
this.compilation,
chunkGraph,
this._chunkGraphModule(module)
)
) {
this._analyzableBailout(
module,
"__webpack_public_path__ is reassigned in a runtime this module belongs to"
);
return false;
}
return form === "import"
? this._supportsAnalyzableImport(
/** @type {ChunkGraph} */ (chunkGraph),
/** @type {Module} */ (module)
)
: this._supportsAnalyzableUrl(form, chunkGraph, module);

@coderabbitai coderabbitai Bot Aug 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Use one runtime scope for the wasm capability decision.

If an unrelated runtime assigns __webpack_public_path__, the unscoped calls return false. The scoped calls in AsyncWebAssemblyJavascriptGenerator can still return true for a wasm module outside that runtime. The generator then passes wasmModuleUrl, but AsyncWasmCompileRuntimeModule or AsyncWasmLoadingRuntimeModule emits the fallback signature that expects module ID and hash values. This breaks wasm loading in mixed-runtime builds.

  • lib/RuntimeTemplate.js#L368-L395: expose a capability check that uses the runtime of the generated runtime module, or make all wasm callers use the same scope.
  • lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js#L75-L86: align the normal-phase baked URL decision with the runtime-module signature decision.
  • lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js#L247-L258: align the source-phase baked URL decision with the runtime-module signature decision.
  • lib/wasm-async/AsyncWasmCompileRuntimeModule.js#L69-L85: select the function signature with the same runtime-scoped decision as its callers.
  • lib/wasm-async/AsyncWasmLoadingRuntimeModule.js#L70-L86: select the function signature with the same runtime-scoped decision as its callers.
  • lib/node/ReadFileCompileAsyncWasmPlugin.js#L67-L69: align wasmUrlArg with the runtime-scoped wasm decision.
  • lib/node/ReadFileCompileAsyncWasmPlugin.js#L138-L145: align full-hash requirements with that same decision.
  • lib/node/ReadFileCompileAsyncWasmPlugin.js#L175-L182: align full-hash requirements with that same decision.
  • lib/wasm-async/UniversalCompileAsyncWasmPlugin.js#L69-L71: align wasmUrlArg with the runtime-scoped wasm decision.
  • lib/web/FetchCompileAsyncWasmPlugin.js#L84-L113: select the loading implementation with the runtime-scoped wasm decision.
  • lib/web/FetchCompileAsyncWasmPlugin.js#L131-L160: select the compilation implementation with the runtime-scoped wasm decision.
📍 Affects 7 files
  • lib/RuntimeTemplate.js#L368-L395 (this comment)
  • lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js#L75-L86
  • lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js#L247-L258
  • lib/wasm-async/AsyncWasmCompileRuntimeModule.js#L69-L85
  • lib/wasm-async/AsyncWasmLoadingRuntimeModule.js#L70-L86
  • lib/node/ReadFileCompileAsyncWasmPlugin.js#L67-L69
  • lib/node/ReadFileCompileAsyncWasmPlugin.js#L138-L145
  • lib/node/ReadFileCompileAsyncWasmPlugin.js#L175-L182
  • lib/wasm-async/UniversalCompileAsyncWasmPlugin.js#L69-L71
  • lib/web/FetchCompileAsyncWasmPlugin.js#L84-L113
  • lib/web/FetchCompileAsyncWasmPlugin.js#L131-L160
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/RuntimeTemplate.js` around lines 368 - 395, Use one runtime-scoped wasm
capability decision so URL arguments, baked URLs, hash requirements, and
runtime-module signatures cannot disagree. In lib/RuntimeTemplate.js:368-395,
expose or standardize the check against the generated runtime module’s runtime;
apply it in lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js:75-86 and
:247-258, lib/wasm-async/AsyncWasmCompileRuntimeModule.js:69-85, and
lib/wasm-async/AsyncWasmLoadingRuntimeModule.js:70-86. Align the same decision
in lib/node/ReadFileCompileAsyncWasmPlugin.js:67-69, :138-145, and :175-182;
lib/wasm-async/UniversalCompileAsyncWasmPlugin.js:69-71; and
lib/web/FetchCompileAsyncWasmPlugin.js:84-113 and :131-160.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
alexander-akait added 7 commits August 12, 2026 08:18
@alexander-akait
fix(esm): keep one scope for the wasm analyzable decision
e28d2a6
The refactor also asked for ESM syntax on a chunk import, which the module
chunk loader emits whatever the target reads; move that check to the url
half. And the wasm loader is emitted once per runtime, so a per-module
answer could hand it a baked url while it emits the id-and-hash signature —
ask compilation-wide for both wasm forms.
@alexander-akait
test(esm): pin the wasm loader's scope against a foreign public-path …
9d778c9
…override

One runtime reassigns the public path, the wasm lives in another. Ask
per-module and the call site bakes a url the loader's own signature never
takes, which the case catches as a missing undefined.module.wasm.
@alexander-akait
chore: regenerate types.d.ts for the trimmed supportsAnalyzable doc
45d1b27
@alexander-akait
test: type the module the analyzable predicate is asked about
45c766a
@alexander-akait
style(esm): trim the wasm-scope comment to two lines
065f5d3
@alexander-akait
refactor(esm): answer the analyzable question in one method
cd8ba1f
@alexander-akait
refactor(esm): fold two more single-use analyzable helpers
a20cf90
@alexander-akait
refactor(esm): move the two pure public-path predicates off the class
7e4190f
@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Types Coverage

Coverage after merging feat/analyzable-asset-and-path-specifiers into main will be
99.26%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
bin
   webpack.js98.82%100%100%98.82%103
examples
   build-common.js100%100%100%100%
   buildAll.js100%100%100%100%
   examples.js100%100%100%100%
   template-common.js98.21%100%100%98.21%72
examples/custom-javascript-parser
   test.filter.js100%100%100%100%
examples/custom-javascript-parser/internals
   acorn-parse.js100%100%100%100%
   meriyah-parse.js100%100%100%100%
   oxc-parse.js100%100%100%100%
examples/markdown
   webpack.config.mjs100%100%100%100%
examples/module-federation
   test.filter.js100%100%100%100%
examples/reexport-components
   test.filter.js100%100%100%100%
examples/typescript
   test.filter.js100%100%100%100%
examples/typescript-non-erasable
   test.filter.js50%100%100%50%5
examples/virtual-modules
   test.filter.js100%100%100%100%
examples/wasm-bindgen-esm
   test.filter.js100%100%100%100%
examples/wasm-complex
   test.filter.js100%100%100%100%
examples/wasm-emscripten
   test.filter.js100%100%100%100%
examples/wasm-simple
   test.filter.js100%100%100%100%
examples/wasm-simple-source-phase
   test.filter.js100%100%100%100%
lib
   APIPlugin.js100%100%100%100%
   AsyncDependenciesBlock.js100%100%100%100%
   AutomaticPrefetchPlugin.js100%100%100%100%
   BannerPlugin.js100%100%100%100%
   Cache.js98.21%100%100%98.21%101
   CacheFacade.js100%100%100%100%
   Chunk.js99.72%100%100%99.72%39
   ChunkGraph.js100%100%100%100%
   ChunkGroup.js100%100%100%100%
   ChunkTemplate.js100%100%100%100%
   CircularModulesPlugin.js98.81%100%100%98.81%136
   CleanPlugin.js99.12%100%100%99.12%214, 234
   CodeGenerationResults.js100%100%100%100%
   CompatibilityPlugin.js100%100%100%100%
   Compilation.js98.44%100%100%98.44%1673, 1992, 1999, 2007, 2029, 2032, 2971, 3450–3451, 3483, 4192, 4222, 4275–4276, 4280, 4285, 4301–4302, 4316–4317, 4322–4323, 4843, 4869, 549, 554, 5679, 5711, 5728, 5746, 5762, 5777, 5802–5803, 5805, 6140, 6145, 6151, 6154, 6161, 6173, 6175, 6179, 6197, 6212, 6246, 6302, 6326, 6442, 801–802
   Compiler.js99.56%100%100%99.56%1168–1169, 1177
   ConcatenationScope.js99.12%100%100%99.12%300
   ConditionalInitFragment.js100%100%100%100%
   ConstPlugin.js100%100%100%100%
   ContextExclusionPlugin.js100%100%100%100%
   ContextModule.js99.88%100%100%99.88%1461
   ContextModuleFactory.js97.20%100%100%97.20%266, 435, 456, 461, 501, 512, 514, 518, 527–528
   ContextReplacementPlugin.js100%100%100%100%
   DefinePlugin.js99.08%100%100%99.08%1080, 176–177, 193, 212, 286
   DependenciesBlock.js100%100%100%100%
   Dependency.js98.51%100%100%98.51%480, 527
   DependencyTemplate.js100%100%100%100%
   DependencyTemplates.js100%100%100%100%
   DotenvPlugin.js98.41%100%100%98.41%378, 391–392
   DynamicEntryPlugin.js100%100%100%100%
   EntryOptionPlugin.js100%100%100%100%
   EntryPlugin.js100%100%100%100%
   Entrypoint.js100%100%100%100%
   EnvironmentPlugin.js97.14%100%100%97.14%49
   ErrorHelpers.js100%100%100%100%
   EvalDevToolModulePlugin.js100%100%100%100%
   EvalSourceMapDevToolPlugin.js100%100%100%100%
   ExportsInfo.js100%100%100%100%
   ExportsInfoApiPlugin.js100%100%100%100%
   ExternalModule.js98.67%100%100%98.67%1220, 1223, 519–523, 525, 671
   ExternalModuleFactoryPlugin.js100%100%100%100%
   ExternalsPlugin.js100%100%100%100%
   FileSystemInfo.js99.53%100%100%99.53%186, 2454–2455, 2458, 2469, 2480, 2491, 284, 3928, 3943, 3967
   FlagAllModulesAsUsedPlugin.js100%100%100%100%
   FlagDependencyExportsPlugin.js98.36%100%100%98.36%504, 513, 516, 520, 532
   FlagDependencyUsagePlugin.js100%100%100%100%
   FlagEntryExportAsUsedPlugin.js100%100%100%100%
   Generator.js100%100%100%100%
   HotModuleReplacementPlugin.js100%100%100%100%
   HotUpdateChunk.js100%100%100%100%
   IgnorePlugin.js100%100%100%100%
   IgnoreWarningsPlugin.js100%100%100%100%
   InitFragment.js100%100%100%100%
   JavascriptMetaInfoPlugin.js100%100%100%100%
   LazyBarrel.js100%100%100%100%
   LibraryTemplatePlugin.js100%100%100%100%
   LoaderOptionsPlugin.js100%100%100%100%
   LoaderTargetPlugin.js100%100%100%100%
   MainTemplate.js100%100%100%100%
   ManifestPlugin.js100%100%100%100%
   Module.js98.51%100%100%98.51%1303, 1308, 1368, 1382, 1444, 1453
   ModuleFactory.js100%100%100%100%
   ModuleFilenameHelpers.js98.90%100%100%98.90%111, 113
   ModuleGraph.js99.78%100%100%99.78%1170
   ModuleGraphConnection.js100%100%100%100%
   ModuleInfoHeaderPlugin.js100%100%100%100%
   ModuleNotFoundError.js100%100%100%100%
   ModuleProfile.js100%100%100%100%
   ModuleSourceTypeConstants.js100%100%100%100%
   ModuleTemplate.js100%100%100%100%
   ModuleTypeConstants.js100%100%100%100%
   MultiCompiler.js99.72%100%100%99.72%721
   MultiStats.js100%100%100%100%
   MultiWatching.js100%100%100%100%
   NoEmitOnErrorsPlugin.js100%100%100%100%
   NodeStuffPlugin.js100%100%100%100%
   NormalModule.js97.99%100%100%97.99%1027, 1030, 1047, 1064, 1312, 1346, 1362, 1817, 2114, 2119–2129, 29
   NormalModuleFactory.js98.77%100%100%98.77%1142, 1410, 1421, 1431, 1482–1484, 1491, 536, 548
   NormalModuleReplacementPlugin.js100%100%100%100%
   NullFactory.js100%100%100%100%
   OptimizationStages.js100%100%100%100%
   OptionsApply.js100%100%100%100%
   Parser.js100%100%100%100%
   PlatformPlugin.js100%100%100%100%
   PrefetchPlugin.js100%100%100%100%
   ProgressPlugin.js99.80%100%100%99.80%690
   ProvidePlugin.js100%100%100%100%
   RawModule.js100%100%100%100%
   RecordIdsPlugin.js100%100%100%100%
   RequestShortener.js100%100%100%100%
   ResolverFactory.js100%100%100%100%
   RuntimeGlobals.js100%100%100%100%
   RuntimeModule.js100%100%100%100%
   RuntimePlugin.js95.69%100%100%95.69%310, 366, 375, 378, 402, 420, 441–442, 465, 485–486, 522–523, 546, 559–560, 632, 645, 666, 685
   RuntimeTemplate.js99.83%100%100%99.83%164, 2363
   SelfModuleFactory.js100%100%100%100%
   SingleEntryPlugin.js100%100%100%100%
   SourceMapDevToolModuleOptionsPlugin.js100%100%100%100%
   SourceMapDevToolPlugin.js98.63%100%100%98.63%220, 224, 226, 420, 431, 890
   Stats.js100%100%100%100%
   Template.js100%100%100%100%
   TemplatedPathPlugin.js99.48%100%100%99.48%364–365
   UseStrictPlugin.js100%100%100%100%
   WarnCaseSensitiveModulesPlugin.js100%100%100%100%
   WarnDeprecatedOptionPlugin.js100%100%100%100%
   WarnNoModeSetPlugin.js100%100%100%100%
   WatchIgnorePlugin.js100%100%100%100%
   Watching.js100%100%100%100%
   WebpackError.js100%100%100%100%
   WebpackIsIncludedPlugin.js100%100%100%100%
   WebpackOptionsApply.js100%100%100%100%
   WebpackOptionsDefaulter.js100%100%100%100%
   buildChunkGraph.js99.87%100%100%99.87%376
   cli.js98.63%100%100%98.63%10, 119, 549, 581, 631, 905
   index.js99.73%100%100%99.73%184
   validateSchema.js94.67%100%100%94.67%100, 87, 89, 98
   webpack.js97.12%100%100%97.12%10, 267, 289, 291
lib/asset
   AssetBytesGenerator.js100%100%100%100%
   AssetBytesParser.js100%100%100%100%
   AssetGenerator.js100%100%100%100%
   AssetModule.js100%100%100%100%
   AssetModulesPlugin.js98.15%100%100%98.15%330, 354, 357, 487, 49, 54
   AssetParser.js100%100%100%100%
   AssetSourceGenerator.js100%100%100%100%
   AssetSourceParser.js100%100%100%100%
   RawDataUrlModule.js100%100%100%100%
   WebManifestGenerator.js100%100%100%100%
   WebManifestParser.js100%100%100%100%
lib/async-modules
   AsyncModuleHelpers.js100%100%100%100%
   AwaitDependenciesInitFragment.js100%100%100%100%
   InferAsyncModulesPlugin.js100%100%100%100%
   isGeneratorLowered.js100%100%100%100%
lib/bun
   BunTargetPlugin.js100%100%100%100%
lib/cache
   AddBuildDependenciesPlugin.js100%100%100%100%
   AddManagedPathsPlugin.js100%100%100%100%
   IdleFileCachePlugin.js97.92%100%100%97.92%75, 87, 95
   MemoryCachePlugin.js92%100%100%92%34, 43
   MemoryWithGcCachePlugin.js93.42%100%100%93.42%108, 122–123, 132, 90
   PackFileCacheStrategy.js96.52%100%100%96.52%1310, 1410, 1414, 1476, 1712, 1796, 1819, 1851, 675, 694, 704–706, 708, 724–725, 730, 733, 735, 740, 745, 770, 776,
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
alexander-akait merged commit 7299185 into main Aug 12, 2026
63 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait
alexander-akait deleted the feat/analyzable-asset-and-path-specifiers branch August 12, 2026 12:50
@github-actions github-actions Bot mentioned this pull request Aug 12, 2026
chore(release): new release #21545
Merged
@alexander-akait alexander-akait mentioned this pull request Aug 13, 2026
fix(esm): correct analyzable references that could go stale, resolve wrongly, or fail the build #21699
Merged
@coderabbitai coderabbitai Bot mentioned this pull request Aug 17, 2026
fix(analyzable): resolve a relative baseUri against the chunk, bake one direction of a hash cycle #21750
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

area: parser JavaScript parsing and dependency analysis (lib/javascript, lib/dependencies) area: runtime Emitted runtime and chunk loading across targets (lib/runtime, lib/web, lib/node, lib/esm) area: types types.d.ts, JSDoc annotations, hand-maintained declarations area: wasm WebAssembly modules (lib/wasm-*)

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@alexander-akait
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.