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 analyzable references per asset, and drop the asset wrapper no one reads by alexander-akait · Pull Request #21688 · webpack/webpack Conversation
|
🦋 Changeset detectedLatest commit: 7e4190f 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.
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Note
|
| 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
| 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.
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 (7299185). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@7299185
yarn add -D webpack@https://pkg.pr.new/webpack@7299185
pnpm add -D webpack@https://pkg.pr.new/webpack@7299185 |
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 #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
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
151 asset(s) changed size, biggest 20 by raw change
54 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: 6
test/configCases/wasm/sync-constant-public-path/webpack.config.js (1)
3-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten 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 winShorten 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 winReduce 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/**/*.jscomments 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 winShorten 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
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.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 14f3c12b-9c39-442d-9dbe-0af3565bcc70
test/statsCases/analyzable-esm-fallbacks/__snapshots__/StatsTest.snap is excluded by !**/*.snap, !test/**/__snapshots__/**types.d.ts is excluded by !types.d.ts.changeset/024-analyzable-asset-urls-and-function-paths.mdlib/RuntimeTemplate.jslib/asset/AssetGenerator.jslib/dependencies/URLDependency.jslib/esm/AnalyzableChunkHashPlugin.jslib/web/FetchCompileWasmPlugin.jstest/AnalyzableChunkHashPlugin.unittest.jstest/configCases/analyzable/asset-url-base-uri/asset.txttest/configCases/analyzable/asset-url-base-uri/index.jstest/configCases/analyzable/asset-url-base-uri/other.jstest/configCases/analyzable/asset-url-base-uri/shared.jstest/configCases/analyzable/asset-url-base-uri/test.config.jstest/configCases/analyzable/asset-url-base-uri/webpack.config.jstest/configCases/analyzable/asset-url-function-public-path/asset.txttest/configCases/analyzable/asset-url-function-public-path/index.jstest/configCases/analyzable/asset-url-function-public-path/webpack.config.jstest/configCases/analyzable/asset-url-matrix/asset.txttest/configCases/analyzable/asset-url-matrix/deep.jstest/configCases/analyzable/asset-url-matrix/flat.jstest/configCases/analyzable/asset-url-matrix/index.jstest/configCases/analyzable/asset-url-matrix/webpack.config.jstest/configCases/analyzable/asset-url-relative-public-path/asset.txttest/configCases/analyzable/asset-url-relative-public-path/deep.jstest/configCases/analyzable/asset-url-relative-public-path/flat.jstest/configCases/analyzable/asset-url-relative-public-path/index.jstest/configCases/analyzable/asset-url-relative-public-path/shared.jstest/configCases/analyzable/asset-url-relative-public-path/webpack.config.jstest/configCases/analyzable/asset-url-shared-depths/asset.txttest/configCases/analyzable/asset-url-shared-depths/deep.jstest/configCases/analyzable/asset-url-shared-depths/flat.jstest/configCases/analyzable/asset-url-shared-depths/index.jstest/configCases/analyzable/asset-url-shared-depths/roundTrip.jstest/configCases/analyzable/asset-url-shared-depths/shared.jstest/configCases/analyzable/asset-url-shared-depths/webpack.config.jstest/configCases/analyzable/asset-url-templated-public-path/asset.txttest/configCases/analyzable/asset-url-templated-public-path/index.jstest/configCases/analyzable/asset-url-templated-public-path/webpack.config.jstest/configCases/analyzable/asset-url-wrapperless/asset.txttest/configCases/analyzable/asset-url-wrapperless/deep.jstest/configCases/analyzable/asset-url-wrapperless/flat.jstest/configCases/analyzable/asset-url-wrapperless/index.jstest/configCases/analyzable/asset-url-wrapperless/shared.jstest/configCases/analyzable/asset-url-wrapperless/webpack.config.jstest/configCases/analyzable/asset-wrapper-retention/asset.txttest/configCases/analyzable/asset-wrapper-retention/index-override.jstest/configCases/analyzable/asset-wrapper-retention/index-plain.jstest/configCases/analyzable/asset-wrapper-retention/index.jstest/configCases/analyzable/asset-wrapper-retention/plain-import.jstest/configCases/analyzable/asset-wrapper-retention/url-only.jstest/configCases/analyzable/asset-wrapper-retention/webpack.config.jstest/configCases/analyzable/dynamic-import-contenthash/index.jstest/configCases/analyzable/dynamic-import-contenthash/webpack.config.jstest/configCases/analyzable/function-chunk-filename/webpack.config.jstest/configCases/analyzable/hashed-chunk-filename/webpack.config.jstest/configCases/analyzable/import-relative-public-path/index.jstest/configCases/analyzable/import-relative-public-path/lazy.jstest/configCases/analyzable/import-relative-public-path/mid.jstest/configCases/analyzable/import-relative-public-path/webpack.config.jstest/configCases/analyzable/shared-depths-import-fallback/index.jstest/configCases/analyzable/shared-depths-import-fallback/test.config.jstest/configCases/analyzable/shared-depths-import-fallback/webpack.config.jstest/configCases/analyzable/shared-module-chunk/index.jstest/configCases/analyzable/shared-module-chunk/lazy.jstest/configCases/analyzable/shared-module-chunk/lib.jstest/configCases/analyzable/shared-module-chunk/roundTrip.jstest/configCases/analyzable/shared-module-chunk/webpack.config.jstest/configCases/analyzable/stand-in-lookalike/index.jstest/configCases/analyzable/stand-in-lookalike/lazy.jstest/configCases/analyzable/stand-in-lookalike/lookalikes.jstest/configCases/analyzable/stand-in-lookalike/webpack.config.jstest/configCases/analyzable/templated-public-path/webpack.config.jstest/configCases/module/public-path/test.config.jstest/configCases/wasm/analyzable-fullhash-filename/webpack.config.jstest/configCases/wasm/analyzable-templated-url-public-path/index.jstest/configCases/wasm/analyzable-templated-url-public-path/webpack.config.jstest/configCases/wasm/sync-constant-public-path/index.jstest/configCases/wasm/sync-constant-public-path/module.jstest/configCases/wasm/sync-constant-public-path/wasm.wattest/configCases/wasm/sync-constant-public-path/webpack.config.jstest/configCases/worker/worker-module-hashed/index.jstest/configCases/worker/worker-module-hashed/webpack.config.jstest/configCases/worker/worker-shared-depths-runtime-path/index.jstest/configCases/worker/worker-shared-depths-runtime-path/webpack.config.jstest/statsCases/analyzable-esm-fallbacks/asset.txttest/statsCases/analyzable-esm-fallbacks/index-eval.jstest/statsCases/analyzable-esm-fallbacks/index-worker.jstest/statsCases/analyzable-esm-fallbacks/test.config.jstest/statsCases/analyzable-esm-fallbacks/webpack.config.jstest/statsCases/analyzable-esm-fallbacks/worker.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.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…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.
There was an error while loading. Please reload this page.
Merging this PR will regress 2 benchmarks
|
| 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)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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.
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.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
lib/RuntimeTemplate.js (1)
350-376: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten 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
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.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: eec26f14-7e3e-4fce-91e5-608cd3b16347
types.d.ts is excluded by !types.d.tslib/RuntimeTemplate.jslib/asset/AssetGenerator.jslib/dependencies/URLDependency.jslib/dependencies/WorkerDependency.jslib/dependencies/WorkletDependency.jslib/node/ReadFileCompileAsyncWasmPlugin.jslib/wasm-async/AsyncWasmCompileRuntimeModule.jslib/wasm-async/AsyncWasmLoadingRuntimeModule.jslib/wasm-async/AsyncWebAssemblyJavascriptGenerator.jslib/wasm-async/UniversalCompileAsyncWasmPlugin.jslib/web/FetchCompileAsyncWasmPlugin.jslib/web/FetchCompileWasmPlugin.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.
| 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); |
There was a problem 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.lib/RuntimeTemplate.js#L368-L395 (this comment)lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js#L75-L86lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js#L247-L258lib/wasm-async/AsyncWasmCompileRuntimeModule.js#L69-L85lib/wasm-async/AsyncWasmLoadingRuntimeModule.js#L70-L86lib/node/ReadFileCompileAsyncWasmPlugin.js#L67-L69lib/node/ReadFileCompileAsyncWasmPlugin.js#L138-L145lib/node/ReadFileCompileAsyncWasmPlugin.js#L175-L182lib/wasm-async/UniversalCompileAsyncWasmPlugin.js#L69-L71lib/web/FetchCompileAsyncWasmPlugin.js#L84-L113lib/web/FetchCompileAsyncWasmPlugin.js#L131-L160Verify 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.
There was an error while loading. Please reload this page.
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.
…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.
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.