GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(esm): widen analyzable output to HMR, hashed and function chunk filenames by alexander-akait · Pull Request #21653 · webpack/webpack Conversation
|
|
| Name | Type |
|---|---|
| webpack | Minor |
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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Warning Review limit reached
Next review available in: 36 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Note
|
| Layer / File(s) | Summary |
|---|---|
Chunk specifier resolution .changeset/..., lib/RuntimeTemplate.js, lib/esm/AnalyzableChunkHashPlugin.js, lib/esm/ModuleChunkLoadingPlugin.js, test/configCases/analyzable/* |
Chunk imports support deferred hash substitution and function-based filename templates. Tests cover hashed, CSS-derived, and dynamic chunk filenames. |
Runtime loading and HMR wiring lib/RuntimePlugin.js, lib/esm/ModuleChunkLoading*.js, lib/hmr/*, lib/runtime/EnsureChunkRuntimeModule.js, test/configCases/analyzable/css-chunk-import/*, test/hotCases/esm-output/analyzable-import/*, test/statsCases/analyzable-esm-fallbacks/* |
Runtime modules separate handler-map generation from the full chunk loader. HMR and lazy compilation preserve required loading paths. |
WebAssembly URL generation lib/RuntimeTemplate.js, lib/web/FetchCompileAsyncWasmPlugin.js, test/configCases/wasm/analyzable-url-public-path/* |
Fetch-based WebAssembly chunks use absolute public-path URLs. Tests cover fetch instantiation, source compilation, and async-node loading modes. |
Possibly related issues
import() chunk loading through statically resolvable specifiers and generated URL-style output.| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title uses the required Conventional Commit format and accurately describes the analyzable ESM output changes. |
| 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
This PR is packaged and the instant preview is available (e3f177c). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@e3f177c
yarn add -D webpack@https://pkg.pr.new/webpack@e3f177c
pnpm add -D webpack@https://pkg.pr.new/webpack@e3f177c |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## main #21653 +/- ## ======================================== Coverage 94.46% 94.47% ======================================== Files 629 630 +1 Lines 80967 81088 +121 Branches 23889 23927 +38 ======================================== + Hits 76489 76605 +116 - Misses 4478 4483 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Generated code sizeComparing
105 asset(s) changed size, biggest 20 by raw change
52 runtime(s) changed which runtime modules they carry, biggest 20 by number moved
Built |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
test/configCases/wasm/analyzable-url-public-path/webpack.config.js (1)
3-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten the configuration comment.
The comment spans four lines. Reduce it to at most two short lines.
As per coding guidelines, 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/configCases/wasm/analyzable-url-public-path/webpack.config.js` around lines 3 - 6, Shorten the comment above the public-path configuration to no more than two concise lines, preserving only the essential distinction between fetch loading and readFile’s file URL behavior.Sources: Coding guidelines, Path instructions
test/configCases/wasm/analyzable-url-public-path/index.js (1)
16-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the
compileWasmruntime path.This test checks only the
instantiateWasmoutput through__webpack_require__.v. A regression in thecompileWasmhook can still retainRuntimeGlobals.publicPathand pass this test. Add an integration case that emitsRuntimeGlobals.compileWasmand asserts its URL does not require the public-path runtime.As per coding guidelines, cover every changed line and branch with tests, preferably through integration cases.
🤖 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/analyzable-url-public-path/index.js` around lines 16 - 22, Extend the integration coverage in the existing wasm analyzable-url tests to exercise the RuntimeGlobals.compileWasm hook, not only instantiateWasm via __webpack_require__.v. Add a case that emits compileWasm and asserts the generated URL is baked in without retaining RuntimeGlobals.publicPath or its runtime URL construction.Sources: Coding guidelines, Path instructions
lib/esm/AnalyzableChunkHashPlugin.js (2)
42-52: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse full local identifier names.
Rename
_err,byId, andreadto names that state their contents or purpose.As per coding guidelines, “Spell function, variable, parameter, and property names out in full.”
Also applies to: 87-100
🤖 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 42 - 52, Rename the catch parameter in readSpecifier from _err to a fully descriptive identifier, and apply the same full-name convention to the byId and read identifiers in the referenced code. Preserve all existing behavior while choosing names that clearly describe each value’s contents or purpose.Source: Coding guidelines
20-23: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueKeep new ordinary comments to two short lines.
lib/esm/AnalyzableChunkHashPlugin.js#L20-L23: split or shorten the placeholder-lifetime comment.lib/esm/AnalyzableChunkHashPlugin.js#L55-L58: split or shorten the deferred-specifier comment.lib/esm/AnalyzableChunkHashPlugin.js#L67-L70: split or shorten the plugin-order comment.lib/esm/ModuleChunkLoadingPlugin.js#L131-L133: split or shorten the HMR handler comment.As per coding guidelines, 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 `@lib/esm/AnalyzableChunkHashPlugin.js` around lines 20 - 23, Shorten or split each ordinary comment to no more than two short lines: the placeholder-lifetime, deferred-specifier, and plugin-order comments in lib/esm/AnalyzableChunkHashPlugin.js at lines 20-23, 55-58, and 67-70, plus the HMR handler comment in lib/esm/ModuleChunkLoadingPlugin.js at lines 131-133. Preserve each comment’s existing meaning.Sources: Coding guidelines, Path instructions
test/configCases/analyzable/hashed-chunk-filename/index.js (1)
9-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winSnapshot the emitted bundles after normalizing variable values.
test/configCases/analyzable/hashed-chunk-filename/index.js#L9-L33: snapshot the emitted bundle after normalizing hash-dependent values.test/configCases/analyzable/css-chunk-import/index.js#L17-L42: snapshotmain.mjsin addition to the targeted runtime assertions.As per coding guidelines, snapshot generated output such as bundles and use explicit assertions for behavior.
🤖 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/hashed-chunk-filename/index.js` around lines 9 - 33, Update the test around the emitted bundle in test/configCases/analyzable/hashed-chunk-filename/index.js:9-33 to normalize hash-dependent values and snapshot the resulting bundle, while preserving the existing explicit assertions. In test/configCases/analyzable/css-chunk-import/index.js:17-42, additionally read and snapshot main.mjs alongside the targeted runtime assertions.Source: Coding guidelines
lib/RuntimeTemplate.js (1)
1847-1855: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueShorten the new explanatory comments.
lib/RuntimeTemplate.js#L1847-L1855: retain only the deferral invariant.test/configCases/analyzable/function-chunk-filename/webpack.config.js#L3-L8: retain only the test-case distinction.test/configCases/analyzable/hashed-chunk-filename/webpack.config.js#L5-L11: retain only therealContentHashcondition.lib/hmr/HotModuleReplacement.runtime.js#L198-L200: reduce the comment to two short lines.lib/hmr/LazyCompilationPlugin.js#L550-L552: reduce the comment to two short lines.As per coding guidelines, comments must be no more than 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 1847 - 1855, Shorten only the explanatory comments at lib/RuntimeTemplate.js lines 1847-1855, test/configCases/analyzable/function-chunk-filename/webpack.config.js lines 3-8, test/configCases/analyzable/hashed-chunk-filename/webpack.config.js lines 5-11, lib/hmr/HotModuleReplacement.runtime.js lines 198-200, and lib/hmr/LazyCompilationPlugin.js lines 550-552: keep only the deferral invariant in RuntimeTemplate, the test-case distinction in the function chunk filename config, the realContentHash condition in the hashed chunk filename config, and reduce each HMR comment to two short lines while preserving non-obvious information.Source: Coding guidelines
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/021-analyzable-import-coverage.md:
- Line 5: Shorten the changeset entry to one imperative sentence of no more than
80 characters, ending with a period, while retaining the essential description
of the analyzable ESM output and loading fixes.
In `@lib/esm/AnalyzableChunkHashPlugin.js`:
- Around line 42-49: Update readSpecifier() to validate the parsed JSON before
returning it: accept only a two-item array whose first element is a string
prefix and whose second element satisfies the existing ChunkId validation;
return null for all other payloads. Ensure processAssets destructuring around
the affected lines only receives this validated shape and does not abort on
malformed or valid-but-unexpected JSON.
In `@lib/RuntimeTemplate.js`:
- Around line 1958-1961: Update the probe chunk setup near probeChunk so
contentHash returns HASH_PROBE for every requested content-hash type, rather
than defining only the javascript key. Add a regression case covering a
CSS-bearing async chunk whose chunkFilename callback reads contentHash.css, and
verify the callback is treated as dynamic and produces the correct filename.
---
Nitpick comments:
In `@lib/esm/AnalyzableChunkHashPlugin.js`:
- Around line 42-52: Rename the catch parameter in readSpecifier from _err to a
fully descriptive identifier, and apply the same full-name convention to the
byId and read identifiers in the referenced code. Preserve all existing behavior
while choosing names that clearly describe each value’s contents or purpose.
- Around line 20-23: Shorten or split each ordinary comment to no more than two
short lines: the placeholder-lifetime, deferred-specifier, and plugin-order
comments in lib/esm/AnalyzableChunkHashPlugin.js at lines 20-23, 55-58, and
67-70, plus the HMR handler comment in lib/esm/ModuleChunkLoadingPlugin.js at
lines 131-133. Preserve each comment’s existing meaning.
In `@lib/RuntimeTemplate.js`:
- Around line 1847-1855: Shorten only the explanatory comments at
lib/RuntimeTemplate.js lines 1847-1855,
test/configCases/analyzable/function-chunk-filename/webpack.config.js lines 3-8,
test/configCases/analyzable/hashed-chunk-filename/webpack.config.js lines 5-11,
lib/hmr/HotModuleReplacement.runtime.js lines 198-200, and
lib/hmr/LazyCompilationPlugin.js lines 550-552: keep only the deferral invariant
in RuntimeTemplate, the test-case distinction in the function chunk filename
config, the realContentHash condition in the hashed chunk filename config, and
reduce each HMR comment to two short lines while preserving non-obvious
information.
In `@test/configCases/analyzable/hashed-chunk-filename/index.js`:
- Around line 9-33: Update the test around the emitted bundle in
test/configCases/analyzable/hashed-chunk-filename/index.js:9-33 to normalize
hash-dependent values and snapshot the resulting bundle, while preserving the
existing explicit assertions. In
test/configCases/analyzable/css-chunk-import/index.js:17-42, additionally read
and snapshot main.mjs alongside the targeted runtime assertions.
In `@test/configCases/wasm/analyzable-url-public-path/index.js`:
- Around line 16-22: Extend the integration coverage in the existing wasm
analyzable-url tests to exercise the RuntimeGlobals.compileWasm hook, not only
instantiateWasm via __webpack_require__.v. Add a case that emits compileWasm and
asserts the generated URL is baked in without retaining
RuntimeGlobals.publicPath or its runtime URL construction.
In `@test/configCases/wasm/analyzable-url-public-path/webpack.config.js`:
- Around line 3-6: Shorten the comment above the public-path configuration to no
more than two concise lines, preserving only the essential distinction between
fetch loading and readFile’s file URL behavior.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 29c9d25d-e1cf-4c9e-9196-f361f487daa8
test/statsCases/analyzable-esm-fallbacks/__snapshots__/StatsTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**.changeset/021-analyzable-import-coverage.mdlib/RuntimePlugin.jslib/RuntimeTemplate.jslib/esm/AnalyzableChunkHashPlugin.jslib/esm/ModuleChunkLoadingPlugin.jslib/esm/ModuleChunkLoadingRuntimeModule.jslib/hmr/HotModuleReplacement.runtime.jslib/hmr/LazyCompilationPlugin.jslib/runtime/EnsureChunkRuntimeModule.jslib/web/FetchCompileAsyncWasmPlugin.jstest/configCases/analyzable/css-chunk-import/index.jstest/configCases/analyzable/function-chunk-filename/index.jstest/configCases/analyzable/function-chunk-filename/lazy.jstest/configCases/analyzable/function-chunk-filename/webpack.config.jstest/configCases/analyzable/hashed-chunk-filename/index.jstest/configCases/analyzable/hashed-chunk-filename/lazy.jstest/configCases/analyzable/hashed-chunk-filename/webpack.config.jstest/configCases/wasm/analyzable-url-public-path/index.jstest/configCases/wasm/analyzable-url-public-path/lazy.jstest/configCases/wasm/analyzable-url-public-path/wasm.wattest/configCases/wasm/analyzable-url-public-path/webpack.config.jstest/hotCases/esm-output/analyzable-import/async-module.jstest/hotCases/esm-output/analyzable-import/index.jstest/hotCases/esm-output/analyzable-import/test.config.jstest/hotCases/esm-output/analyzable-import/test.filter.jstest/hotCases/esm-output/analyzable-import/webpack.config.jstest/statsCases/analyzable-esm-fallbacks/test.config.jstest/statsCases/analyzable-esm-fallbacks/webpack.config.jsCodeRabbit considers these linked repositories for cross-repo context during reviews:
webpack/schema-utils (auto-detected)webpack/tapable (auto-detected)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Merging this PR will regress 1 benchmark
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | benchmark "future-defaults", scenario '{"name":"mode-development","mode":"development"}' |
817.3 KB | 1,027.9 KB | -20.48% |
| ⚡ | Memory | benchmark "context-commonjs", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
2,635 KB | 425 KB | ×6.2 |
| ⚡ | Memory | benchmark "devtool-eval", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
950.8 KB | 469.3 KB | ×2 |
| ⚡ | Memory | benchmark "css-modules", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
1,231.1 KB | 752.7 KB | +63.55% |
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-esm-hmr (4baf010) with main (b599774)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
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 104-109: The contentHash probe in RuntimeTemplate must preserve
the original chunk.contentHash key set while returning the probe hash for each
key. Build the proxy target from chunk.contentHash’s existing keys, retain the
fallback get behavior for unknown direct reads, and add a regression case where
the filename is derived from Object.keys(pathData.chunk.contentHash).
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 71e15662-7c3c-41cb-9c0a-8937e5a430ac
.changeset/021-analyzable-import-coverage.mdlib/RuntimeTemplate.jslib/esm/AnalyzableChunkHashPlugin.jslib/esm/ModuleChunkLoadingPlugin.jslib/hmr/HotModuleReplacement.runtime.jslib/hmr/LazyCompilationPlugin.jstest/configCases/analyzable/css-content-hash-filename/index.jstest/configCases/analyzable/css-content-hash-filename/lazy.jstest/configCases/analyzable/css-content-hash-filename/style.csstest/configCases/analyzable/css-content-hash-filename/test.config.jstest/configCases/analyzable/css-content-hash-filename/test.filter.jstest/configCases/analyzable/css-content-hash-filename/webpack.config.jstest/configCases/analyzable/function-chunk-filename/webpack.config.jstest/configCases/analyzable/hashed-chunk-filename/webpack.config.jstest/configCases/wasm/analyzable-url-public-path/index.jstest/configCases/wasm/analyzable-url-public-path/lazy-source.jstest/configCases/wasm/analyzable-url-public-path/webpack.config.jstest/hotCases/esm-output/analyzable-import/test.filter.jsCodeRabbit considers these linked repositories for cross-repo context during reviews:
webpack/schema-utils (auto-detected)webpack/tapable (auto-detected)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| probeChunk.contentHash = new Proxy( | ||
| {}, | ||
| { | ||
| get: (target, key) => (typeof key === "string" ? hash : undefined), | ||
| has: () => true | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve the original contentHash key set in the probe.
Line 104 replaces contentHash with a Proxy over an empty object. A chunkFilename callback that uses Object.keys(), for...in, or hasOwnProperty() sees no hash keys in both probes. The callback can then appear hash-independent during code generation but produce a hash-based filename during asset emission.
Create the probe from the original chunk.contentHash keys and replace each key value with the probe hash. Keep a fallback get trap for unknown direct reads. Add a regression case that derives the filename from Object.keys(pathData.chunk.contentHash).
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 104 - 109, The contentHash probe in
RuntimeTemplate must preserve the original chunk.contentHash key set while
returning the probe hash for each key. Build the proxy target from
chunk.contentHash’s existing keys, retain the fallback get behavior for unknown
direct reads, and add a regression case where the filename is derived from
Object.keys(pathData.chunk.contentHash).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The gate refused the analyzable form for any compilation with HMR applied. The hot require special-cased `ensureChunk` (`.e`) to block an update on a chunk load in flight and copied everything else through, so `.ei` escaped that wrapper — and it defined `.e` even when the runtime had none. Wrap `.ei` the same way and define each wrapper only when it exists. Lazy compilation generates a proxy between builds rather than from changed source, so one already loaded outlives the build that required `ensureChunk`; keep it in the runtime there instead of refusing the analyzable form everywhere.
`supportsAnalyzableWasm` chained through `supportsAnalyzableEsmUrl`, so it inherited an `auto` public path requirement it does not have: a public path that is a complete URL bakes just as well, because `new URL(...)` ignores its base for an absolute specifier. A root- or directory-relative one still cannot — the runtime form resolves it against the document and a baked one against the chunk — and neither can a loader that hands the result to `readFile`, which takes a `file:` URL alone. Those keep addressing the binary relative to their chunk, as they already did.
…unks A chunk carrying css or resource-hint children asked for `ensureChunk` just to get the `.f` map its handlers attach to, and that pulled in the js chunk loader and the chunk id to filename table behind it — the runtime the analyzable form exists to replace. `.ei` dispatches every handler but `.f.j` itself, so ask for the map alone and let `EnsureChunkRuntimeModule` emit `.e` only where it is used. The hot runtime registers its own handler on the map and force-loads through the others by bare chunk id, so HMR keeps both the map and the loader — which an all-analyzable graph had silently been dropping since HMR started emitting the analyzable form.
A function was refused on its type alone, without asking what it returns. Call it for its template instead, and apply the same hash test to the answer. No hash is knowable at this point — during code generation `chunk.contentHash` is still empty and `chunk.hash` unset — so a function reading one would name a file that is never emitted. A second call against a stand-in chunk carrying sentinel hashes says whether the answer depends on them; one that does keeps the runtime form, as does a template with a hash placeholder in it.
A hashed name is settled long after the code referencing it is generated, so the specifier is emitted as a stand-in and filled in once the hash exists. That covers `output.chunkFilename` carrying any hash, and so `[fullhash]` in a WebAssembly filename too — the last names the analyzable form could not address. The stand-in carries the prefix and chunk id rather than an index into per-build state: a module restored from the persistent cache is never generated again, and one that outlived its registry would reach the bundle unreplaced. Substituting rewrites a chunk after its own content hash was taken, so the form is kept only where `optimization.realContentHash` brings the two back in line.
The stand-in was filled in from a path missing `runtime`, which the call naming the asset passes. A `[runtime]` in the template then resolved to `_` rather than the runtime's name, so the specifier addressed a file that is never emitted. Cover every placeholder a chunk filename can carry, asserting the baked name is one on disk instead of a string fixed in the test.
…ing it The probe telling whether a function's answer depends on a hash meant "fall back", from when nothing could resolve one later. The deferred pass asks the function again with the hashes settled, so it now means "defer" — `null` stays for a function that throws, which no later call rescues. Both hash-bearing shapes bake as a result: a template carrying a placeholder, and a name built from `pathData` directly.
`blockPromise` drops any chunk without an id before it calls, so the check never fired — measured across the config and stats suites, where the operand was evaluated 296 times and was true none of them. The one in `_getAnalyzableChunkSpecifier` stays: `WorkerDependency` reaches that without the same filter, and an id-less stand-in would reach the bundle verbatim instead of falling back. Says so now.
…nction A function `output.chunkFilename` reading `contentHash.css` saw the same missing value in both calls, so the name looked constant and `undefined` was baked into the specifier. Probe with two distinct hashes exposed for every type instead. Also skip the analyzable HMR case where ESM output cannot build `require`, and reject a stand-in payload that is not a chunk reference.
`[runtime]` and `pathData.runtime` were absent where the specifier is baked, so both read back empty and the name looked settled — `src_lazy_js.undefined.mjs` was emitted against a `src_lazy_js.main.mjs` on disk. Hand the runtime to every site that resolves a chunk filename, as the deferred pass already does.
Which content hashes a chunk carries is settled no earlier than their values are, so a filename function reading `Object.keys(chunk.contentHash)` saw an empty set in both probes and baked `src_lazy_js.none.mjs` against a `src_lazy_js.javascript-css.mjs` on disk. The probes now disagree about which hashes exist, so asking defers just as reading one does.
2d2cac3 to
592ffcd
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
test/configCases/wasm/analyzable-url-public-path/index.js (1)
4-5: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueShorten the test comments.
State each reason in one short line. As per coding guidelines, "
{lib,hot,tooling,test}/**/*.{js,mjs}: Keep comments as short as possible, generally one line and no more than two short lines; comments must add non-obvious information and must not narrate or restate code."Also applies to: 10-11
🤖 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/analyzable-url-public-path/index.js` around lines 4 - 5, Shorten the comments in the analyzable-url-public-path test to one concise line per reason, preserving only the non-obvious details that the binary is intentionally referenced but not called and that the test verifies the URL webpack embeds for the public path.Source: Coding guidelines
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/configCases/wasm/analyzable-url-public-path/index.js`:
- Around line 4-5: Shorten the comments in the analyzable-url-public-path test
to one concise line per reason, preserving only the non-obvious details that the
binary is intentionally referenced but not called and that the test verifies the
URL webpack embeds for the public path.
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e5b5f5b5-1600-4e95-8b0f-6ec5b8debd04
test/statsCases/analyzable-esm-fallbacks/__snapshots__/StatsTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**.changeset/021-analyzable-import-coverage.mdlib/RuntimePlugin.jslib/RuntimeTemplate.jslib/esm/AnalyzableChunkHashPlugin.jslib/esm/ModuleChunkLoadingPlugin.jslib/esm/ModuleChunkLoadingRuntimeModule.jslib/hmr/HotModuleReplacement.runtime.jslib/hmr/LazyCompilationPlugin.jslib/runtime/EnsureChunkRuntimeModule.jslib/web/FetchCompileAsyncWasmPlugin.jstest/configCases/analyzable/css-chunk-import/index.jstest/configCases/analyzable/css-content-hash-filename/index.jstest/configCases/analyzable/css-content-hash-filename/lazy.jstest/configCases/analyzable/css-content-hash-filename/style.csstest/configCases/analyzable/css-content-hash-filename/test.config.jstest/configCases/analyzable/css-content-hash-filename/test.filter.jstest/configCases/analyzable/css-content-hash-filename/webpack.config.jstest/configCases/analyzable/function-chunk-filename/index.jstest/configCases/analyzable/function-chunk-filename/lazy.jstest/configCases/analyzable/function-chunk-filename/webpack.config.jstest/configCases/analyzable/hashed-chunk-filename/index.jstest/configCases/analyzable/hashed-chunk-filename/lazy.jstest/configCases/analyzable/hashed-chunk-filename/webpack.config.jstest/configCases/wasm/analyzable-url-public-path/index.jstest/configCases/wasm/analyzable-url-public-path/lazy-source.jstest/configCases/wasm/analyzable-url-public-path/lazy.jstest/configCases/wasm/analyzable-url-public-path/wasm.wattest/configCases/wasm/analyzable-url-public-path/webpack.config.jstest/hotCases/esm-output/analyzable-import/async-module.jstest/hotCases/esm-output/analyzable-import/index.jstest/hotCases/esm-output/analyzable-import/test.config.jstest/hotCases/esm-output/analyzable-import/test.filter.jstest/hotCases/esm-output/analyzable-import/webpack.config.jstest/statsCases/analyzable-esm-fallbacks/test.config.jstest/statsCases/analyzable-esm-fallbacks/webpack.config.jsCodeRabbit considers these linked repositories for cross-repo context during reviews:
webpack/schema-utils (auto-detected)webpack/tapable (auto-detected)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ync chunks The hot runtime force-loads through the handler map by bare chunk id, so the analyzable path keeps `.f.j` around — but only where there is an async chunk to force-load. Requiring it unconditionally pulled the handler map, the chunk-filename helper and the whole `import()` loader into every `output.module` HMR build: +2.80 KiB on configCases/module/import-meta-hot-priority.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.