Skip to content

Add namespace re-export support to import-export plugin (#1768)#1768

Open
robhogan wants to merge 1 commit into
mainfrom
export-D111013905
Open

Add namespace re-export support to import-export plugin (#1768)#1768
robhogan wants to merge 1 commit into
mainfrom
export-D111013905

Conversation

@robhogan

@robhogan robhogan commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary:

Add static import/export plugin (experimentalImportSupport) support for namespace re-exports, i.e. export * as Name from "module".

This was added to Expo's fork in expo/expo#38055, (h/t krystofwoldrich).

Despite this being perfectly valid syntax it currently fails to transform under experimantalImportSupport, with:

Cannot read properties of undefined (reading 'name')
    at <..>/metro-transform-plugins/src/import-export-plugin.js:289:67

(On access of local.name, because this type of export has no local binding)

Spec

ECMA-262 includes namespace re-export syntax in the ExportDeclaration grammar: https://tc39.es/ecma262/#prod-ExportDeclaration

Implementation

Metro's existing experimentalImportSupport transform already has namespace import helper plumbing via importAll. This change reuses that helper and then emits an explicit export assignment for the namespace object, keeping the change isolated to the static transform path.

 - **[Experimental]** Support `export * as Name from "module"` under `experimentalImportSupport`

Reviewed By: huntie

Differential Revision: D111013905

@meta-codesync

meta-codesync Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@robhogan has exported this pull request. If you are a Meta employee, you can view the originating Diff in D111013905.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 8, 2026
@meta-codesync meta-codesync Bot changed the title Add namespace re-export support to import-export plugin Add namespace re-export support to import-export plugin (#1768) Jul 9, 2026
meta-codesync Bot pushed a commit that referenced this pull request Jul 9, 2026
Summary:

Add static import/export plugin (`experimentalImportSupport`) support for namespace re-exports, i.e. `export * as Name from "module"`.

This was added to Expo's fork in expo/expo#38055, (h/t krystofwoldrich).

Despite this being perfectly valid syntax it currently fails to transform under `experimantalImportSupport`, with: 

```
Cannot read properties of undefined (reading 'name')
    at <..>/metro-transform-plugins/src/import-export-plugin.js:289:67
```

(On access of `local.name`, because this type of export has no `local` binding)

## Spec

ECMA-262 includes namespace re-export syntax in the ExportDeclaration grammar: https://tc39.es/ecma262/#prod-ExportDeclaration

## Implementation

Metro's existing `experimentalImportSupport` transform already has namespace import helper plumbing via `importAll`. This change reuses that helper and then emits an explicit export assignment for the namespace object, keeping the change isolated to the static transform path.

```
 - **[Experimental]** Support `export * as Name from "module"` under `experimentalImportSupport`
```

Reviewed By: huntie

Differential Revision: D111013905
@meta-codesync meta-codesync Bot force-pushed the export-D111013905 branch from 3527da8 to 2aaccef Compare July 9, 2026 10:59
meta-codesync Bot pushed a commit that referenced this pull request Jul 9, 2026
Summary:

Add static import/export plugin (`experimentalImportSupport`) support for namespace re-exports, i.e. `export * as Name from "module"`.

This was added to Expo's fork in expo/expo#38055, (h/t krystofwoldrich).

Despite this being perfectly valid syntax it currently fails to transform under `experimantalImportSupport`, with: 

```
Cannot read properties of undefined (reading 'name')
    at <..>/metro-transform-plugins/src/import-export-plugin.js:289:67
```

(On access of `local.name`, because this type of export has no `local` binding)

## Spec

ECMA-262 includes namespace re-export syntax in the ExportDeclaration grammar: https://tc39.es/ecma262/#prod-ExportDeclaration

## Implementation

Metro's existing `experimentalImportSupport` transform already has namespace import helper plumbing via `importAll`. This change reuses that helper and then emits an explicit export assignment for the namespace object, keeping the change isolated to the static transform path.

```
 - **[Experimental]** Support `export * as Name from "module"` under `experimentalImportSupport`
```

Reviewed By: huntie

Differential Revision: D111013905
@meta-codesync meta-codesync Bot force-pushed the export-D111013905 branch from 2aaccef to 2a95a6d Compare July 9, 2026 11:47
meta-codesync Bot pushed a commit that referenced this pull request Jul 9, 2026
Summary:

Add static import/export plugin (`experimentalImportSupport`) support for namespace re-exports, i.e. `export * as Name from "module"`.

This was added to Expo's fork in expo/expo#38055, (h/t krystofwoldrich).

Despite this being perfectly valid syntax it currently fails to transform under `experimantalImportSupport`, with: 

```
Cannot read properties of undefined (reading 'name')
    at <..>/metro-transform-plugins/src/import-export-plugin.js:289:67
```

(On access of `local.name`, because this type of export has no `local` binding)

## Spec

ECMA-262 includes namespace re-export syntax in the ExportDeclaration grammar: https://tc39.es/ecma262/#prod-ExportDeclaration

## Implementation

Metro's existing `experimentalImportSupport` transform already has namespace import helper plumbing via `importAll`. This change reuses that helper and then emits an explicit export assignment for the namespace object, keeping the change isolated to the static transform path.

```
 - **[Experimental]** Support `export * as Name from "module"` under `experimentalImportSupport`
```

Reviewed By: huntie

Differential Revision: D111013905
@meta-codesync meta-codesync Bot force-pushed the export-D111013905 branch from 2a95a6d to 5143d31 Compare July 9, 2026 14:32
Summary:

Add static import/export plugin (`experimentalImportSupport`) support for namespace re-exports, i.e. `export * as Name from "module"`.

This was added to Expo's fork in expo/expo#38055, (h/t krystofwoldrich).

Despite this being perfectly valid syntax it currently fails to transform under `experimantalImportSupport`, with: 

```
Cannot read properties of undefined (reading 'name')
    at <..>/metro-transform-plugins/src/import-export-plugin.js:289:67
```

(On access of `local.name`, because this type of export has no `local` binding)

## Spec

ECMA-262 includes namespace re-export syntax in the ExportDeclaration grammar: https://tc39.es/ecma262/#prod-ExportDeclaration

## Implementation

Metro's existing `experimentalImportSupport` transform already has namespace import helper plumbing via `importAll`. This change reuses that helper and then emits an explicit export assignment for the namespace object, keeping the change isolated to the static transform path.

```
 - **[Experimental]** Support `export * as Name from "module"` under `experimentalImportSupport`
```

Reviewed By: huntie

Differential Revision: D111013905
@meta-codesync meta-codesync Bot force-pushed the export-D111013905 branch from 5143d31 to b586457 Compare July 9, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant