Skip to content

fix: use RuntimeKey instead of Runtime for export generation#20346

Merged
alexander-akait merged 7 commits intomainfrom
issue-20332
Jan 26, 2026
Merged

fix: use RuntimeKey instead of Runtime for export generation#20346
alexander-akait merged 7 commits intomainfrom
issue-20332

Conversation

@hai-x
Copy link
Member

@hai-x hai-x commented Jan 22, 2026

Summary

Fixes #20332.

What kind of change does this PR introduce?

In RuntimeSpecSet, we deduplicate runtimes by RuntimeKey, so no extra runtimes are stored here when it have same RuntimeKey.

However, when a concatenated module is generated in different chunks that share the same runtime value (equal in value but not the same reference), we still need to generate the export statement. To ensure it, we should use RuntimeKey to make sure that no runtimes are missing.

Did you add tests for your changes?

Yes

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?

No

@changeset-bot
Copy link

changeset-bot bot commented Jan 22, 2026

🦋 Changeset detected

Latest commit: 938944a

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

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

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2026

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

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@3a73621
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@3a73621
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@3a73621

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 22, 2026

CodSpeed Performance Report

Merging this PR will improve performance by 27.82%

Comparing issue-20332 (938944a) with main (bf00b73)

Summary

⚡ 1 improved benchmark
✅ 71 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
benchmark "asset-modules-bytes", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 44.1 ms 34.5 ms +27.82%

* @property {Map<RuntimeSpec, Record<string, string>>=} exportsFinalNameByRuntime
* @property {Map<RuntimeSpec, string>=} exportsSourceByRuntime
* @property {Map<string, Record<string, string>>=} exportsFinalNameByRuntime
* @property {Map<string, string>=} exportsSourceByRuntime
Copy link
Member

Choose a reason for hiding this comment

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

Is the expected change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, getRuntimeKey return string.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Looks good

@hai-x
Copy link
Member Author

hai-x commented Jan 24, 2026

Added the test. But we need to merge #20350 first to fix an issue in the ESM test runner.

@hai-x hai-x marked this pull request as ready for review January 24, 2026 09:45
@alexander-akait
Copy link
Member

@hai-x let's rebase 😄

@hai-x
Copy link
Member Author

hai-x commented Jan 26, 2026

Added the test. But we need to merge #20350 first to fix an issue in the ESM test runner.

I just missed adding the key fix in #20350; it has now been included in this PR.

Also i update the lockfile. And now everything is done.

@alexander-akait alexander-akait merged commit 3a73621 into main Jan 26, 2026
51 of 56 checks passed
@alexander-akait alexander-akait deleted the issue-20332 branch January 26, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module Federation crashes with production configuration in Angular 21

2 participants