fix: use real resource when export from external#12136
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes external module re-exports to use the actual request path instead of the user-facing alias when generating ESM library output. The key issue was that when an external module is aliased (e.g., 'external': 'module path'), the generated re-export statements should use the actual module path ('path') rather than the alias ('external').
Key changes:
- Added
get_request()method toExternalModuleto retrieve the appropriate request value based on the external request type - Updated
re_export_from_external_module()to usemodule.get_request().primary()instead ofmodule.user_request()orexport_dep.request - Removed the
export_depparameter fromre_export_from_external_module()as it's no longer needed - Added test case for aliased external re-exports
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/external_module.rs | Added get_request() method to retrieve the correct request value for external modules |
| crates/rspack_plugin_esm_library/src/link.rs | Updated re-export logic to use actual request paths instead of user requests and removed unused parameter |
| tests/rspack-test/esmOutputCases/externals/aliased/rspack.config.js | Added test configuration for aliased external module |
| tests/rspack-test/esmOutputCases/externals/aliased/index.js | Added test case to verify correct export behavior |
| tests/rspack-test/esmOutputCases/externals/aliased/snapshots/esm.snap.txt | Added snapshot showing expected output with actual module path |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Binary Size-limit
❌ Size increased by 384bytes from 47.93MB to 47.93MB (⬆️0.00%) |
CodSpeed Performance ReportMerging #12136 will not alter performanceComparing Summary
|
Summary
Use real resource when we are exporting from an external module instead of raw user request.
Related links
Checklist