fix: deduplicate re-exported external named imports within chunks#10225
Draft
IWANABETHATGUY wants to merge 2 commits into
Draft
fix: deduplicate re-exported external named imports within chunks#10225IWANABETHATGUY wants to merge 2 commits into
IWANABETHATGUY wants to merge 2 commits into
Conversation
Member
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label graphite: merge-when-ready to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
IWANABETHATGUY
force-pushed
the
refactor/extract-external-import-symbol-merging
branch
from
July 12, 2026 11:05
b9fc5a6 to
fe6becc
Compare
graphite-app
Bot
changed the base branch from
refactor/extract-external-import-symbol-merging
to
graphite-base/10225
July 12, 2026 11:35
graphite-app
Bot
force-pushed
the
graphite-base/10225
branch
from
July 12, 2026 11:40
fe6becc to
c5adb85
Compare
graphite-app
Bot
force-pushed
the
fix/3427-dedupe-external-reexport-imports
branch
from
July 12, 2026 11:40
959bc01 to
c85b8fe
Compare
graphite-app
Bot
force-pushed
the
fix/3427-dedupe-external-reexport-imports
branch
from
July 12, 2026 11:41
c85b8fe to
61eebc2
Compare
✅ Deploy Preview for rolldown-rs canceled.
|
IWANABETHATGUY
force-pushed
the
fix/3427-dedupe-external-reexport-imports
branch
from
July 12, 2026 12:36
61eebc2 to
e8b4f02
Compare
Member
Author
|
To use Codex here, create a Codex account and connect to github. |
IWANABETHATGUY
force-pushed
the
fix/3427-dedupe-external-reexport-imports
branch
from
July 12, 2026 13:57
e8b4f02 to
91b1235
Compare
IWANABETHATGUY
force-pushed
the
fix/3427-dedupe-external-reexport-imports
branch
from
July 14, 2026 07:32
91b1235 to
0cb04b3
Compare
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.

Description
close #3427
Supersedes #8218.
Root cause
#3405 stopped merging external named imports whose local binding is re-exported (
export { a } from 'ext'), because eager merging happens before chunks exist and can move a symbol's canonical ref where a chunk can't render it: in ESM output a chunk renders external imports only from its own modules'named_imports(direct_imports_from_external_modules), andcompute_chunk_importsintentionally skips external-owned symbols. That fixed the Nuxt crash, but it left every re-export of the same(external module, name)pair as its own symbol:Fix
Defer the merge until chunk assignment is known, then merge strictly per chunk (next to the existing namespace merger in
merge_external_import_symbols):bind_imports_and_exportsnow collects re-exported external named imports intodeferred_external_binding_merges, keyed by(external module, imported name), instead of skipping them.(exec_order, symbol index), preferring a member whose name equals the imported name so the output readsimport { a }rather thanimport { a as a$1 }.The per-chunk restriction preserves #3405's constraint by construction: a merged group's canonical always stays a symbol declared inside that chunk, so cross-chunk references keep flowing through the regular cross-chunk import/export machinery. (This is also where #8218 went wrong: it linked re-export symbols from every chunk into the external-owned facade, which reintroduces the #3405 scenario for indirect importers.)
Tests
Two node-executed fixtures assert runtime identity of the merged bindings:
external/reexport_external_binding_dedup: single chunk; plain import + re-export + pass-through re-export (named and default) collapse to one specifier each.external/splitting_reexport_external_dedup: the fix(splitting): indirect external symbol #3405 splitting shape; the shared chunk collapses its duplicate re-exports into one import/one cross-chunk export, while the entry chunks' facade correctly does not fold across chunks.Rollup compat suite: 1214 passed / 0 failed.