-
-
Notifications
You must be signed in to change notification settings - Fork 757
fix: concatenate module should use importer's 'strict' for interop #12446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this 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 fixes a bug in module concatenation where the interop behavior was incorrectly determined by the re-exported module's strictEsm setting instead of the importer module's setting. The fix ensures that when resolving re-exports during module concatenation, the system uses the importer's strict_esm_module flag to determine the correct ES module interop behavior.
- Updated
get_final_bindingrecursive call to use the current (importer) module'sstrict_esm_moduleflag instead of the reexport target's flag - Added comprehensive test case demonstrating correct interop behavior with
.js(non-strict) and.mjs(strict) file extensions importing from a CommonJS module with__esModulemarker
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/rspack_core/src/concatenated_module.rs |
Fixed recursive get_final_binding call to use importer's strict_esm_module flag for correct interop resolution |
tests/rspack-test/configCases/concatenate-modules/interop/rspack.config.js |
Test configuration enabling module concatenation |
tests/rspack-test/configCases/concatenate-modules/interop/index.js |
Test entry point validating correct interop behavior for both .js and .mjs importers |
tests/rspack-test/configCases/concatenate-modules/interop/module.js |
Non-strict ESM module re-exporting from CommonJS |
tests/rspack-test/configCases/concatenate-modules/interop/module.mjs |
Strict ESM module re-exporting from CommonJS |
tests/rspack-test/configCases/concatenate-modules/interop/module-normal.cjs |
CommonJS module with __esModule marker and both function export and default property |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rsdoctor Bundle Diff AnalysisFound 5 project(s) in monorepo. 📁 react-10kPath:
📦 Download Diff Report: react-10k Bundle Diff 📁 react-5kPath:
📦 Download Diff Report: react-5k Bundle Diff 📁 react-1kPath:
📦 Download Diff Report: react-1k Bundle Diff 📁 ui-componentsPath:
📦 Download Diff Report: ui-components Bundle Diff 📁 romePath:
📦 Download Diff Report: rome Bundle Diff Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🎉 Size decreased by 256bytes from 48.20MB to 48.20MB (⬇️0.00%) |
CodSpeed Performance ReportMerging #12446 will not alter performanceComparing Summary
|
Summary
Concatenated module get_binding should use import module's
buildMeta.strictEsmto get export, to make interop correct, the behavior should be the same as which not concatenateedRelated links
Checklist