Skip to content

Remove deprecated default exports from public entry points (#1759)#1759

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

Remove deprecated default exports from public entry points (#1759)#1759
robhogan wants to merge 1 commit into
mainfrom
export-D110062342

Conversation

@robhogan

@robhogan robhogan commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary:

Remove the deprecated default-object export from Metro packages. The supported public API is now exclusively named exports, so any consumer importing a Metro package's default - directly, or implicitly via Babel/TypeScript esModuleInterop - will break and must migrate to named imports.

This affects the public entry points of metro, metro-config, metro-cache, metro-core, metro-resolver, metro-source-map, metro-babel-transformer, and metro-transform-worker.

Default imports like these will no longer work:

import metro from 'metro';
metro.runServer(config);

import metroConfig from 'metro-config';
const config = await metroConfig.loadConfig();
const metro = require('metro').default;
metro.runBuild(config, options);

Switch to named imports instead:

import {runServer, runBuild} from 'metro';
import {loadConfig, mergeConfig} from 'metro-config';

runServer(config);
const {runBuild} = require('metro');
runBuild(config, options);

Namespace imports are unaffected and continue to work, since they bind the package's named exports:

import * as metro from 'metro';
metro.runServer(config);

Changelog: [Breaking] Removed the deprecated default export from Metro's public packages; use named (or namespace) imports instead.


Reviewed By: huntie

Differential Revision: D110062342

@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 Jun 30, 2026
@meta-codesync

meta-codesync Bot commented Jun 30, 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 D110062342.

Summary:

Remove the deprecated default-object export from Metro packages. The supported public API is now exclusively named exports, so any consumer importing a Metro package's default - directly, or implicitly via Babel/TypeScript `esModuleInterop` - will break and must migrate to named imports.

This affects the public entry points of `metro`, `metro-config`, `metro-cache`, `metro-core`, `metro-resolver`, `metro-source-map`, `metro-babel-transformer`, and `metro-transform-worker`.

Default imports like these will no longer work:

```js
import metro from 'metro';
metro.runServer(config);

import metroConfig from 'metro-config';
const config = await metroConfig.loadConfig();
```

```js
const metro = require('metro').default;
metro.runBuild(config, options);
```

Switch to named imports instead:

```js
import {runServer, runBuild} from 'metro';
import {loadConfig, mergeConfig} from 'metro-config';

runServer(config);
```

```js
const {runBuild} = require('metro');
runBuild(config, options);
```

Namespace imports are unaffected and continue to work, since they bind the package's named exports:

```js
import * as metro from 'metro';
metro.runServer(config);
```

Changelog: [Breaking] Removed the deprecated default export from Metro's public packages; use named (or namespace) imports instead.

___

Reviewed By: huntie

Differential Revision: D110062342
@meta-codesync meta-codesync Bot changed the title Remove deprecated default exports from public entry points Remove deprecated default exports from public entry points (#1759) Jun 30, 2026
@meta-codesync meta-codesync Bot force-pushed the export-D110062342 branch from 769a7f1 to 68affd8 Compare June 30, 2026 14:15
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