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): bake templated public paths and hashed wasm names into analyzable output by alexander-akait · Pull Request #21669 · webpack/webpack Conversation
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
🦋 Changeset detectedLatest commit: 424df4a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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: 20 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 ignored due to path filters (2)
📒 Files selected for processing (25)
Note
|
| Layer / File(s) | Summary |
|---|---|
Context-aware analyzability lib/APIPlugin.js, lib/RuntimeTemplate.js, lib/dependencies/*, lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js, test/configCases/analyzable/block-without-origin/*, test/configCases/analyzable/public-path-override-scope/*, test/configCases/analyzable/templated-worker-public-path/* |
Public-path overrides are tracked per module and runtime. Analyzability checks receive chunk-graph and module context. Tests cover origin-less blocks, scoped overrides, and worker output. |
Deferred hash substitution lib/TemplatedPathPlugin.js, lib/RuntimePlugin.js, lib/esm/AnalyzableChunkHashPlugin.js, lib/RuntimeTemplate.js, test/configCases/analyzable/deferred-before-source-maps/*, test/configCases/analyzable/templated-public-path/*, test/statsCases/analyzable-esm-fallbacks/* |
Safe full-hash and chunk-specifier placeholders are resolved during derived asset processing. Replacements use ReplaceSource, and tests verify generated paths and source-map alignment. |
WebAssembly full-hash runtime handling lib/wasm/*, lib/wasm-async/*, lib/wasm-sync/*, lib/node/*WasmPlugin.js, lib/web/*WasmPlugin.js, test/configCases/wasm/* |
WebAssembly filename helpers distinguish runtime hash access from digest encoding. Sync and async runtime modules receive digest settings and use deferred compilation hash data. Tests cover analyzable, synchronous, asynchronous, source-phase, and digest filenames. |
Possibly related PRs
RuntimeTemplate runtime public-path and deferred-import logic.Suggested labels: area: sourcemaps
| 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 form, an allowed type and scope, and accurately describes the main 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 (bc65f6b). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@bc65f6b
yarn add -D webpack@https://pkg.pr.new/webpack@bc65f6b
pnpm add -D webpack@https://pkg.pr.new/webpack@bc65f6b |
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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## main #21669 +/- ## ======================================== Coverage 94.52% 94.53% ======================================== Files 630 631 +1 Lines 82008 82147 +139 Branches 24272 24320 +48 ======================================== + Hits 77520 77655 +135 - Misses 4488 4492 +4
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
80 asset(s) changed size, biggest 20 by raw change
35 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 an error while loading. Please reload this page.
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
lib/wasm/wasmModuleFilename.js (1)
18-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueKeep new explanatory comments to two short lines.
lib/wasm/wasmModuleFilename.js#L18-L20: shorten theneedsRuntimeFullHashcomment.test/configCases/wasm/analyzable-fullhash-filename/webpack.config.js#L58-L65: shorten both explanatory comments.test/configCases/wasm/full-hash-digest-filename/webpack.config.js#L3-L5: shorten the digest interpolation comment.test/configCases/wasm/full-hash-digest-filename/webpack.config.js#L47-L49: shorten the plain full-hash comment.As per coding guidelines, comments must generally 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/wasm/wasmModuleFilename.js` around lines 18 - 20, Shorten the explanatory comments at lib/wasm/wasmModuleFilename.js:18-20 near needsRuntimeFullHash, both comments at test/configCases/wasm/analyzable-fullhash-filename/webpack.config.js:58-65, the digest interpolation comment at test/configCases/wasm/full-hash-digest-filename/webpack.config.js:3-5, and the plain full-hash comment at test/configCases/wasm/full-hash-digest-filename/webpack.config.js:47-49 so each is no more than two short lines while preserving the relevant explanation.Source: Coding guidelines
lib/TemplatedPathPlugin.js (1)
78-81: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep the
lib/comment within the two-line limit.Lines 78-81 use four comment lines. Compress the explanation to two short lines.
Suggested replacement
-// `[fullhash:<digest>]`/`[hash:<digest>]` — a non-numeric first argument is a digest -// (a numeric one is just a length). A digest re-encodes the hash rather than reading -// it, so no stand-in or runtime expression can take its place: the settled value has -// to be inlined instead. +// `[fullhash:<digest>]`/`[hash:<digest>]`: non-numeric args request digest re-encoding; +// numeric args are lengths, so digest values must be inlined after hash settlement.As per coding guidelines, comments in
{lib,hot,tooling,test}/**/*.{js,mjs}must be no more than two short lines.
As per path instructions, comments inlib/**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 `@lib/TemplatedPathPlugin.js` around lines 78 - 81, Compress the explanatory comment in TemplatedPathPlugin.js describing non-numeric digest arguments and inlining settled hash values from four lines to no more than two short lines, preserving the same meaning.Sources: Coding guidelines, Path instructions
lib/esm/AnalyzableChunkHashPlugin.js (1)
21-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReduce the new block comments to two short lines.
Keep only information that the code does not express.
lib/esm/AnalyzableChunkHashPlugin.js#L21-L23: shorten the token-format comment.lib/esm/AnalyzableChunkHashPlugin.js#L46-L48: shorten the deferred-path-data comment.lib/esm/AnalyzableChunkHashPlugin.js#L99-L103: shorten the class-purpose comment.lib/esm/AnalyzableChunkHashPlugin.js#L118-L122: shorten the asset-stage comment.lib/esm/AnalyzableChunkHashPlugin.js#L175-L176: reduce the comment that begins on line 174.lib/esm/AnalyzableChunkHashPlugin.js#L192-L194: shorten theReplaceSourcecomment.test/configCases/analyzable/deferred-before-source-maps/webpack.config.js#L3-L5: shorten the source-map ordering comment.test/statsCases/analyzable-esm-fallbacks/webpack.config.js#L59-L61: shorten the fallback-condition comment.As per coding guidelines, comments must be short and generally 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 `@lib/esm/AnalyzableChunkHashPlugin.js` around lines 21 - 23, Shorten the comments at lib/esm/AnalyzableChunkHashPlugin.js lines 21-23, 46-48, 99-103, 118-122, 175-176, and 192-194 to no more than two short lines each, retaining only non-obvious information. Also shorten the comments at test/configCases/analyzable/deferred-before-source-maps/webpack.config.js lines 3-5 and test/statsCases/analyzable-esm-fallbacks/webpack.config.js lines 59-61 to the same two-line limit, without changing code behavior.Sources: Coding guidelines, Path instructions
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: Use .changeset/021-analyzable-import-coverage.md as the single minor
changeset: retain its feature-level release note and merge in the source-map
behavior from .changeset/023-analyzable-substitution-source-maps.md#L5-L5.
Delete .changeset/023-analyzable-substitution-source-maps.md after merging its
note.
In `@lib/wasm-async/AsyncWebAssemblyModulesPlugin.js`:
- Around line 82-84: Shorten the comment above AnalyzableChunkHashPlugin to two
short lines while preserving the reason it must be applied: binary names may
contain a compilation hash placeholder that this pass fills during chunk
loading, and applying it twice is harmless.
In `@test/configCases/analyzable/deferred-before-source-maps/index.js`:
- Around line 20-27: Extend the source-map assertions in the
deferred-before-source-maps test after the existing line-count checks: decode
map.mappings and assert that a generated position following the substituted
specifier resolves to the expected location in index.js. Use explicit expect()
assertions for the decoded source, original line, and column so stale generated
columns are detected, and add a snapshot of the generated output as requested.
---
Nitpick comments:
In `@lib/esm/AnalyzableChunkHashPlugin.js`:
- Around line 21-23: Shorten the comments at
lib/esm/AnalyzableChunkHashPlugin.js lines 21-23, 46-48, 99-103, 118-122,
175-176, and 192-194 to no more than two short lines each, retaining only
non-obvious information. Also shorten the comments at
test/configCases/analyzable/deferred-before-source-maps/webpack.config.js lines
3-5 and test/statsCases/analyzable-esm-fallbacks/webpack.config.js lines 59-61
to the same two-line limit, without changing code behavior.
In `@lib/TemplatedPathPlugin.js`:
- Around line 78-81: Compress the explanatory comment in TemplatedPathPlugin.js
describing non-numeric digest arguments and inlining settled hash values from
four lines to no more than two short lines, preserving the same meaning.
In `@lib/wasm/wasmModuleFilename.js`:
- Around line 18-20: Shorten the explanatory comments at
lib/wasm/wasmModuleFilename.js:18-20 near needsRuntimeFullHash, both comments at
test/configCases/wasm/analyzable-fullhash-filename/webpack.config.js:58-65, the
digest interpolation comment at
test/configCases/wasm/full-hash-digest-filename/webpack.config.js:3-5, and the
plain full-hash comment at
test/configCases/wasm/full-hash-digest-filename/webpack.config.js:47-49 so each
is no more than two short lines while preserving the relevant explanation.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b757d220-af94-4e14-8656-b1e54d9d6309
test/statsCases/analyzable-esm-fallbacks/__snapshots__/StatsTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**types.d.ts is excluded by !types.d.ts.changeset/021-analyzable-import-coverage.md.changeset/022-wasm-full-hash-digest-filename.md.changeset/023-analyzable-substitution-source-maps.mdlib/APIPlugin.jslib/RuntimePlugin.jslib/RuntimeTemplate.jslib/TemplatedPathPlugin.jslib/dependencies/URLDependency.jslib/dependencies/WorkerDependency.jslib/dependencies/WorkletDependency.jslib/esm/AnalyzableChunkHashPlugin.jslib/node/ReadFileCompileAsyncWasmPlugin.jslib/node/ReadFileCompileWasmPlugin.jslib/wasm-async/AsyncWasmCompileRuntimeModule.jslib/wasm-async/AsyncWasmLoadingRuntimeModule.jslib/wasm-async/AsyncWebAssemblyJavascriptGenerator.jslib/wasm-async/AsyncWebAssemblyModulesPlugin.jslib/wasm-async/UniversalCompileAsyncWasmPlugin.jslib/wasm-sync/WasmChunkLoadingRuntimeModule.jslib/wasm/wasmModuleFilename.jslib/web/FetchCompileAsyncWasmPlugin.jslib/web/FetchCompileWasmPlugin.jstest/configCases/analyzable/block-without-origin/index.jstest/configCases/analyzable/block-without-origin/lazy.jstest/configCases/analyzable/block-without-origin/test.filter.jstest/configCases/analyzable/block-without-origin/webpack.config.jstest/configCases/analyzable/deferred-before-source-maps/dynamic.jstest/configCases/analyzable/deferred-before-source-maps/index.jstest/configCases/analyzable/deferred-before-source-maps/webpack.config.jstest/configCases/analyzable/public-path-override-scope/index.jstest/configCases/analyzable/public-path-override-scope/overriding-lazy.jstest/configCases/analyzable/public-path-override-scope/overriding.jstest/configCases/analyzable/public-path-override-scope/plain-lazy.jstest/configCases/analyzable/public-path-override-scope/plain.jstest/configCases/analyzable/public-path-override-scope/webpack.config.jstest/configCases/analyzable/templated-public-path/dynamic.jstest/configCases/analyzable/templated-public-path/index.jstest/configCases/analyzable/templated-public-path/webpack.config.jstest/configCases/analyzable/templated-worker-public-path/index.jstest/configCases/analyzable/templated-worker-public-path/test.config.jstest/configCases/analyzable/templated-worker-public-path/test.filter.jstest/configCases/analyzable/templated-worker-public-path/webpack.config.jstest/configCases/analyzable/templated-worker-public-path/worker.jstest/configCases/wasm/analyzable-fullhash-filename/index.jstest/configCases/wasm/analyzable-fullhash-filename/module.jstest/configCases/wasm/analyzable-fullhash-filename/test.config.jstest/configCases/wasm/analyzable-fullhash-filename/wasm.wattest/configCases/wasm/analyzable-fullhash-filename/webpack.config.jstest/configCases/wasm/full-hash-digest-filename/index.jstest/configCases/wasm/full-hash-digest-filename/module.jstest/configCases/wasm/full-hash-digest-filename/wasm.wattest/configCases/wasm/full-hash-digest-filename/webpack.config.jstest/configCases/wasm/full-hash-digest-source-phase/index.jstest/configCases/wasm/full-hash-digest-source-phase/module.jstest/configCases/wasm/full-hash-digest-source-phase/wasm.wattest/configCases/wasm/full-hash-digest-source-phase/webpack.config.jstest/configCases/wasm/full-hash-digest-sync/index.jstest/configCases/wasm/full-hash-digest-sync/module.jstest/configCases/wasm/full-hash-digest-sync/wasm.wattest/configCases/wasm/full-hash-digest-sync/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.
| // The name reached the bundle and the file it names reached disk. | ||
| expect(specifier).not.toBe(null); | ||
| expect(fs.existsSync(path.join(dir, specifier[1].slice(2)))).toBe(true); | ||
| // A map generated before substitution would describe a longer file. | ||
| expect(map.mappings.length).toBeGreaterThan(0); | ||
| expect(code.split("\n").length).toBeGreaterThanOrEqual( | ||
| map.mappings.split(";").length - 1 | ||
| ); |
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
Assert a resolved source-map position.
The line-count check cannot detect stale generated columns. Full-hash substitution changes columns without changing line count. Decode the map and assert that a generated position after the substituted specifier resolves to the expected original index.js position.
As per coding guidelines, snapshot generated output and use explicit assertions for behavior and invariants. As per path instructions, use explicit expect() assertions for behavior.
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/deferred-before-source-maps/index.js` around
lines 20 - 27, Extend the source-map assertions in the
deferred-before-source-maps test after the existing line-count checks: decode
map.mappings and assert that a generated position following the substituted
specifier resolves to the expected location in index.js. Use explicit expect()
assertions for the decoded source, original line, and column so stale generated
columns are detected, and add a snapshot of the generated output as requested.
Sources: Coding guidelines, Path instructions
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 @.changeset/022-analyzable-public-path-and-wasm-names.md:
- Line 5: Shorten the changeset summary in
022-analyzable-public-path-and-wasm-names.md to a concise imperative sentence of
80 characters or fewer, and ensure it ends with a period while preserving the
intended change.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b80aff52-4ab7-4196-a9f3-4604dd8b6141
.changeset/022-analyzable-public-path-and-wasm-names.mdlib/TemplatedPathPlugin.jslib/esm/AnalyzableChunkHashPlugin.jslib/wasm-async/AsyncWebAssemblyModulesPlugin.jslib/wasm/wasmModuleFilename.jstest/configCases/analyzable/deferred-before-source-maps/index.jstest/configCases/analyzable/deferred-before-source-maps/webpack.config.jstest/configCases/wasm/analyzable-fullhash-filename/webpack.config.jstest/configCases/wasm/full-hash-digest-filename/webpack.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.
`output.webassemblyModuleFilename` with a `[fullhash]` in it was the one name the analyzable wasm reference could not be built from, because the compilation hash does not exist during code generation. The call site now resolves everything it does know and leaves the hash as a stand-in, which the deferred pass fills in once it is settled — the same mechanism a hashed chunk specifier already uses, so it carries the same `realContentHash` requirement. A `[fullhash:<digest>]` re-encodes the hash rather than reading it, which a stand-in cannot survive, so that form keeps the runtime path. Where the url is baked the runtime no longer interpolates the name at all, so `getFullHash` is no longer pulled into those bundles.
A `[fullhash]` in `output.publicPath` (or `output.workerPublicPath`) made the whole specifier unknowable during code generation, so every chunk reference fell back to the runtime loader. The prefix is now resolved as far as code generation can, leaving the compilation hash as a stand-in for the deferred pass — the same `getPath` call `PublicPathRuntimeModule` makes once that hash exists, so the baked value and the runtime one cannot disagree. The stand-in a templated public path leaves sits inside the specifier the chunk pass writes, so the hash pass now runs after it rather than deciding from the original source whether to run at all. That is what lets a hashed chunk name and a hashed public path be deferred together. A `[fullhash:<digest>]` re-encodes the hash rather than reading it, which a stand-in cannot survive, so that form keeps the runtime path.
The checks deciding whether a reference can be baked had spread across
`RuntimeTemplate`, `AnalyzableChunkHashPlugin` and the call sites, so what
webpack cannot make analyzable was only readable by collecting `if`s from
several files.
They are now three methods on `RuntimeTemplate`, with one doc block above
them naming what each rules out and what none of them cover:
- `supportsAnalyzableEsm` — a `new URL(…, import.meta.url)` literal
- `supportsAnalyzableImport` — an `import("./chunk.js")` literal
- `canDeferAnalyzableName` — a name filled in after the hashes exist
The two forms stay separate on purpose. A literal `import()` survives an
`eval` devtool and `import.meta` does not, so folding them together would
have silently dropped analyzable imports from every default development
build. Deferral keeps two modes for the same reason: a whole name that is
re-resolved later accepts any hash spelling, while one carrying a stand-in
cannot survive a re-encoded digest.
No behaviour change: 30 builds across public paths, hash spellings and
devtools are byte-identical before and after.
A `[fullhash:<digest>]` in `output.webassemblyModuleFilename` re-encodes the hash rather than reading it, so the runtime `getFullHash()` expression the loader interpolates could not stand in for it — re-encoding that expression as if it were a hash dropped the whole segment. The loader then fetched a path no emitted file had, and every wasm module in the build failed to load. The settled hash is inlined instead, the way `GetChunkFilenameRuntimeModule` already does it for chunk names: the runtime module re-renders after hashing and writes the re-encoded value straight into the name. With nothing left to read at runtime, those builds no longer pull in `getFullHash` either. The digest predicate had been copied into two files and the `[fullhash]` one into four more; both now come from `TemplatedPathPlugin`, next to the re-encoder they describe.
…d in The substitution ran at `PROCESS_ASSETS_STAGE_OPTIMIZE_HASH - 1`, long after source maps are written (stage 500) and a minifier has run (stage 400). A stand-in and the name replacing it are different lengths, so every mapping after it on the same line moved — and in a minified bundle that is one line, so effectively the whole file. `RealContentHashPlugin` is exempt from this only because it swaps a hash for a hash of equal length. Every hash the pass reads is settled well before then — `createHash` runs ahead of every `processAssets` stage — so it now runs at `STAGE_DERIVED`, ahead of anything that reads an asset, and replaces in place through `ReplaceSource` so the asset carries its mappings across the edit. Measured on a minified bundle: the emitted map's mappings sat 16 columns to the right of the code they described, exactly the length a stand-in loses when the real name replaces it. A stand-in reaching the source-map stage is now a build error in `configCases/analyzable/deferred-before-source-maps`.
The gate asked for `RealContentHashPlugin` because substituting rewrites a chunk after its own content hash was taken, leaving the name it is emitted under describing content it no longer has. That only costs anything when a name is built from content: with `[name].js` there is nothing to go stale, and the repair pass has nothing to repair. So deferring is now allowed either way — when the repair pass is there, or when no emitted javascript takes its name from its own content. A templated public path and a `[fullhash]` wasm name therefore bake in a plain development build, where `realContentHash` is off by default. A hashed chunk name still needs the repair pass, and inherently so: the referencing chunk's hash would have to depend on the referenced chunk's, which is what `RealContentHashPlugin` settles after the fact.
`blockPromise` types `chunkGraph` as required and all six callers pass one, so the check could never be false; `tsc` agrees once the parameter says so. The origin module is a different matter — `require.ensure", an AMD `require`, a lazy-once context and a container entry all leave it out — so that check stays, with the callers that omit it named, and is now covered by `configCases/analyzable/block-without-origin`. Instrumenting each condition and running the suite is what separated the two: across 24418 tests everything else in the predicate is reached, including the public-path override and the worker chunk-loading branch.
Reassigning `__webpack_public_path__` anywhere turned off analyzable output for the whole compilation. But `__webpack_require__.p` belongs to a runtime, and a module is instantiated once per runtime, so a reassignment can only reach the runtimes the reassigning module is in — an entry that never touches the public path was giving up baked specifiers because a different entry did. The overriding modules are now tracked per compilation rather than a single flag, and the check places the module a reference is emitted into among their runtimes. Where there is no chunk graph to place it with, such as the asset generator deciding a module's source types before code generation, it still answers for the whole compilation. Covered by `configCases/analyzable/public-path-override-scope`, where one entry reassigns the public path and another, in the same build, still bakes.
…e maps The ordering fix had no case with a real minifier: `deferred-before-source-maps` asserts structurally that no stand-in reaches stage 500, but nothing built a minified bundle and checked the map against it. The new case runs terser over a hash-named chunk and asserts no mapping points past the end of the line it names — which is exactly how the stand-in's extra length showed up. It fails when the substitution is moved back to `OPTIMIZE_HASH - 1`. Marked for RoundTripConfigCases so the minified specifier is re-bundled too.
3b09c2b to
afe772c
Compare
The rebase dropped three commits as already-upstream, which reverted 021 (a merged PR's entry) to a modified state, brought back the two changesets it replaced, and undid the trailing-\r fix the Windows shards caught.
A tree comparison against the pre-rebase head found three more casualties: the two cases covering the fullHash runtime modules, and the supportsRequireInModule filter that keeps block-without-origin off the Node versions whose vm ESM runner cannot link createRequire.
Concatenation replaces every module it absorbs with one `ConcatenatedModule`, so the chunk graph places the latter and knows nothing about the former. The analyzable predicates asked it about the module that wrote the reference, which under `optimization.concatenateModules` — on by default in production — is an absorbed one: no chunks, so no output depth to make the specifier relative to, and the literal was dropped for the runtime form. Resolving through the containing `ConcatenatedModule` also un-blinds the two guards that read runtimes: a worker entry not loading through `import`, and a `__webpack_public_path__` reassignment in an absorbed module — both were being asked about a module in no runtime at all. `statsCases/output-module` shows the effect on a case that is not new: its entry is a concatenation, and it now sheds two runtime modules (5 → 3).
8856213 to
424df4a
Compare
Types CoverageCoverage after merging feat/analyzable-public-path-override-scope into main will be
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Unable to generate the flame graphsThe performance report has correctly been generated, but there was an internal error while generating the flame graphs for this run. We're working on fixing the issue. Feel free to contact us on Discord or at [email protected] if the issue persists. |
Sorry, something went wrong.
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.