Skip to content

fix: use index maps for concatenated export rendering#13875

Merged
JSerFeng merged 1 commit intoweb-infra-dev:mainfrom
JSerFeng:fy/use-indexmap-concatenated-exports
Apr 29, 2026
Merged

fix: use index maps for concatenated export rendering#13875
JSerFeng merged 1 commit intoweb-infra-dev:mainfrom
JSerFeng:fy/use-indexmap-concatenated-exports

Conversation

@JSerFeng
Copy link
Copy Markdown
Contributor

Summary

  • use FxIndexMap/FxIndexSet for ConcatenatedModule export rendering so definitions, unused exports, and inlined exports keep deterministic insertion order without sorting
  • add a concatenate-modules regression case for deterministic export definitions and unused export comments

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings April 29, 2026 06:42
@github-actions github-actions Bot added the release: bug fix release: bug related release(mr only) label Apr 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to ensure deterministic rendering of ConcatenatedModule export definitions and related comments by relying on insertion-ordered collections instead of sorting or unordered hash iteration, and adds a regression test to lock the behavior in.

Changes:

  • Switch ConcatenatedModule export rendering to use FxIndexMap / FxIndexSet so iteration order is deterministic.
  • Remove the now-unnecessary sort step when rendering __webpack_require__.d(exports, { ... }).
  • Add a new concatenate-modules config case to assert deterministic export definition ordering and // UNUSED EXPORTS comment ordering.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/rspack_core/src/concatenated_module.rs Use insertion-ordered maps/sets to make export definition + unused/inlined export comment rendering deterministic without sorting.
tests/rspack-test/configCases/concatenate-modules/deterministic-export-comments/rspack.config.js Test config enabling concatenation/usedExports/providedExports to exercise the rendering path.
tests/rspack-test/configCases/concatenate-modules/deterministic-export-comments/index.js Regression assertion for deterministic rendered export definitions and unused export comments.
tests/rspack-test/configCases/concatenate-modules/deterministic-export-comments/root.js Test module defining used/unused exports to validate ordering.
tests/rspack-test/configCases/concatenate-modules/deterministic-export-comments/dep.js Small dependency used by the exported functions to ensure they’re retained/used.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/rspack_core/src/concatenated_module.rs
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 29, 2026

Merging this PR will not alter performance

✅ 34 untouched benchmarks


Comparing JSerFeng:fy/use-indexmap-concatenated-exports (560961b) with main (c211dbe)

Open in CodSpeed

@JSerFeng JSerFeng merged commit d761125 into web-infra-dev:main Apr 29, 2026
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants