fix(esm_lib_plugin): should set original module for get_binding#12584
fix(esm_lib_plugin): should set original module for get_binding#12584
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the ESM library plugin where required modules were not being associated with their originating module. By setting the correct original module for required modules via the from parameter in add_require calls, the fix ensures that required modules are rendered before they are accessed.
- Updated two
add_requirecalls inget_bindingto pass thefromparameter instead ofNone - Added test case demonstrating the fix with module import ordering
- Updated inline code formatting in documentation
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/rspack_plugin_esm_library/src/link.rs |
Fixed two locations where add_require was called with None instead of the from parameter, ensuring proper module rendering order |
crates/rspack_plugin_esm_library/src/chunk_link.rs |
Improved documentation formatting by adding backticks around inline code example |
tests/rspack-test/esmOutputCases/interop/contains-cjs/lib.js |
New test file containing the test logic that was moved from index.js |
tests/rspack-test/esmOutputCases/interop/contains-cjs/index.js |
Simplified to just import the lib module, testing the module ordering fix |
tests/rspack-test/esmOutputCases/interop/contains-cjs/__snapshots__/esm.snap.txt |
Updated snapshot showing correct module comment ordering (// ./lib.js before // ./index.js) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 1 project with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 romePath:
📦 Download Diff Report: rome Bundle Diff Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🙈 Size remains the same at 47.85MB |
CodSpeed Performance ReportMerging #12584 will not alter performanceComparing Summary
Footnotes
|
Summary
Should set correct original module for required module, so that required module will render before access
Related links
Checklist