Skip to content

Keep import attributes whe transforming export namespace - #18586

Merged
nicolo-ribaudo merged 2 commits into
mainfrom
jlhwung/fix-export-namespace-from-attributes
Nov 17, 2026
Merged

nicolo-ribaudo merged 2 commits into
mainfrom
jlhwung/fix-export-namespace-from-attributes

Conversation

@JLHwung

@JLHwung JLHwung commented Nov 11, 2026

Copy link
Copy Markdown
Contributor
Q                       A
Fixed Issues? The transform result of export * as ns from "mod" with { type: "json" } loses the import attributes.
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
Need backport? No
License MIT

In this PR we fix an issue similar to #16233: This is a part of a broader Babel issue: A Babel plugin for an older language features do not pass through later language features due to the stale AST factory usage. Such issues cause plugin ordering issues: and they are typically very tedious to check / fix, but with LLM we can detect and fix them one by one, so this PR is stacked on the #18581.

@JLHwung
JLHwung added this pull request to stack #18587 November 11, 2026 13:39
@JLHwung JLHwung added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Nov 11, 2026
@babel-bot

babel-bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/63377

@pkg-pr-new

pkg-pr-new Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

commit: c4b8930

@JLHwung
JLHwung force-pushed the jlhwung/fix-export-namespace-from-attributes branch from 3f4a502 to 6d07a3d Compare November 12, 2026 02:25

@nicolo-ribaudo nicolo-ribaudo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though I think in #18581 we should just error, this PR is good because which module-related plugins are enabled or not rarely depends on the browser targets.

@JLHwung
JLHwung force-pushed the jlhwung/fix-export-namespace-from-attributes branch from 6d07a3d to b3b4189 Compare November 16, 2026 18:24
Base automatically changed from jlhwung/fix-computed-properties-spread to main November 16, 2026 21:24
export * as ns from "mod" with { type: "json" }

was compiled to an import declaration without the attributes, they are now preserved and cloned if necessary.

Assisted-by: Claude Fable 5.2
export default m from "mod" with { type: "json" }

was compiled to an export declaration without the attributes, they are now cloned.

Assisted-by: Claude Fable 5.2
@JLHwung
JLHwung force-pushed the jlhwung/fix-export-namespace-from-attributes branch from b3b4189 to c4b8930 Compare November 16, 2026 21:25
@nicolo-ribaudo nicolo-ribaudo changed the title fix(export-namespace-from): Keep import attributes Keep import attributes whe transforming export namespace Nov 17, 2026
@nicolo-ribaudo
nicolo-ribaudo added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 8ffe23d Nov 17, 2026
40 checks passed
@nicolo-ribaudo
nicolo-ribaudo deleted the jlhwung/fix-export-namespace-from-attributes branch November 17, 2026 12:13
@babel-bot

Copy link
Copy Markdown
Collaborator

Backported to 7.x in #18645.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants