Repository navigation
fix(wasm): resolve binaries from nested runtime chunks - #22916
Conversation
🦋 Changeset detectedLatest commit: 0516f0a 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 |
|
This PR is packaged and the instant preview of its latest commit is available. Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@22916
yarn add -D webpack@https://pkg.pr.new/webpack@22916
pnpm add -D webpack@https://pkg.pr.new/webpack@22916 |
Types CoverageCoverage after merging fix/wasm-nested-runtime-path into main will be
Coverage Report |
Generated code sizeComparing base (
Read No asset that both runs emit changed size — everything below is new or deleted. 12 asset(s) this pull request adds
No runtime that both runs build changed which runtime modules it carries. 6 runtime(s) this pull request adds or no longer builds
Built |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Runtime path generation lib/wasm/AsyncWasmCompileRuntimeModule.js, lib/wasm/AsyncWasmLoadingRuntimeModule.js |
Both runtime modules add the optional useRelativePath option, defaulting to false. When enabled, each prefixes the configured WebAssembly filename with the runtime chunk’s relative output directory. |
Plugin configuration lib/node/ReadFileCompileAsyncWasmPlugin.js, lib/wasm/UniversalCompileAsyncWasmPlugin.js, .changeset/043-wasm-nested-runtime-path.md |
The Node and universal plugins enable useRelativePath for both runtime modules. The changeset describes the nested-output path fix. |
Nested output tests test/configCases/wasm/nested-runtime/*, test/configCases/wasm/nested-worker-runtime/* |
Config cases test eager WebAssembly imports with nested runtime output and WebAssembly loading from a nested worker. The cases include runtime-specific filters and bundle configuration. |
Suggested labels: area: wasm
Suggested reviewers: magic-akari, alexander-akait
Priority:
Change: Bug fix
Merge Risk: 
Minimal · up to 0516f
-
The nested runtime paths point to the emitted WebAssembly assets. No actionable issue remains before merge.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title follows the conventional-commit form
fix(wasm): subject. The typefixand the scopewasmare valid. The subject "resolve binaries from nested runtime chunks" matches the main change. The changeset fixes Async WebAssembly loading when the runtime chunk is emitted in a subdirectory, and the PR objectives state the same title. The title does not state a branch prefix, so the branch-match part of the requirement cannot be verified from the provided context.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Merging this PR will degrade performance by 9.23%2 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
Summary
Async WebAssembly fails when its runtime is emitted in a subdirectory: fallback filenames resolve next to the JavaScript instead of the output root. This affects universal and async-node loading, including workers and source-phase imports.
For example:
The emitted path changes from:
Compute the prefix during code generation and fold it into the existing literal, adding no runtime operations. CommonJS async-node also needs this without
eval. Complete URLs and fetch loading throughpublicPathkeep their existing behavior.Targeted
yarn test:size: affected bundles gain 2–6 bytes gzip (+12 raw bytes each); 79 assets are unchanged. No runtime modules are added.What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes:
test/configCases/wasm/nested-runtime/andnested-worker-runtime/. The first reproduces eight failures on main. All 196 targeted tests pass across ConfigTestCases and ConfigCacheTestCases, all changed executable lines are covered, and full lint passes.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
Codex assisted with reproducing the bug, implementing the fix, writing and running regression tests, and drafting this description.
Summary by CodeRabbit