fix: render CommonJS externals directly in modern-module output - #15238
Conversation
📦 Binary Size-limit
❌ Size increased by 32.13KB from 68.80MB to 68.83MB (⬆️0.05%) |
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
Merging this PR will not alter performance
Comparing Footnotes
|
|
Oh man, this has been a major pet peeve of mine, I'm glad it's being worked on. Also duplicate imports from |
805eab3 to
85c23c5
Compare
f19acca to
8d157d5
Compare
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d157d54f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 751e35276f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Render native ESM externals through dependency templates and share CommonJS request rendering. Preserve fallback identities, guard generated bindings, reserve named class expression bindings, and update existing output snapshots.
751e352 to
83a28c0
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
rspack/crates/rspack_plugin_esm_library/src/plugin.rs
Lines 811 to 815 in 83a28c0
When two issuer-scoped module externals are merged into one chunk and a non-canonical copy uses only a nested property (for example, one issuer consumes external.a.x), its top-level export is marked OnlyPropertiesUsed, not Used. This filter therefore omits that export from used_exports; after all connections are moved to the canonical module, usage analysis is not rerun, so collect_module_external_remapping can treat the export as unused and generate a namespace without it. Merge OnlyPropertiesUsed and its nested usage state, or conservatively promote every non-Unused export to Used on the canonical module.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
It's the same with current main, as external module cannot produce nested exports info |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b58bcf20db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
<agent: daily-job rspack eco-ci> Eco-CI:
|
Summary
library.type: "modern-module", removing the intermediate external module factory.node-commonjsrequests, including reused module graphs and mixed/multi-entry consumers.createRequireinit fragment.For an eligible external, emitted code now keeps
require("external")(or thecreateRequireequivalent for Node builtins) in the rendered module instead of routing through a generatedexternal "external"factory.Related links
Supersedes #14948.
Validation
corepack pnpm run build:binding:devcorepack pnpm run build:jscorepack pnpm test EsmOutput.test.js(522 tests)cargo test -p rspack_plugin_esm_library commonjs_external::testscargo test -p rspack_core module_graph::connection::testscargo clippy -p rspack_core -p rspack_plugin_esm_library -p rspack_plugin_externals --all-targets -- -D warningscargo fmt --all --checkcorepack pnpm run lint:jsChecklist