fix: should export external aliased right#12143
Merged
Conversation
✅ Deploy Preview for rspack canceled.
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the handling of re-exported modules in the ESM library plugin by replacing a manual loop-based export resolution with a call to the get_target() helper function, and adds test coverage for externals with aliased exports.
- Replaces manual export chain traversal with
get_target()helper call - Uses resolved target's IDs instead of always using original item.ids
- Adds support for handling inlined exports from invalid targets in concatenated modules
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/rspack-test/esmOutputCases/externals/externals-aliased/rspack.config.js | Config for new test case testing aliased external modules |
| tests/rspack-test/esmOutputCases/externals/externals-aliased/module.js | Test module that re-exports from 'fs' with aliases |
| tests/rspack-test/esmOutputCases/externals/externals-aliased/index.js | Test case verifying aliased external exports work correctly |
| tests/rspack-test/esmOutputCases/externals/externals-aliased/snapshots/esm.snap.txt | Expected output snapshot for the aliased externals test |
| crates/rspack_plugin_esm_library/src/link.rs | Refactored export resolution logic to use get_target(), added inlined export handling for invalid targets |
| crates/rspack_core/src/exports/target.rs | Changed find_target_from_export_info visibility from pub(crate) to pub |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
📦 Binary Size-limit
❌ Size increased by 384bytes from 48.09MB to 48.09MB (⬆️0.00%) |
CodSpeed Performance ReportMerging #12143 will not alter performanceComparing Summary
|
a2307c3 to
7f38828
Compare
7f38828 to
eb38c0a
Compare
eb38c0a to
2d2e881
Compare
Timeless0911
approved these changes
Nov 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Should handle renamed re-export from external module. Use
get_targetto find the final bindingShould be rendered as
Related links
Checklist