Skip to content

Update Metro imports to use package root exports #51261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @oncall react_native
*/

import type {AssetData} from 'metro/src/Assets';
import type {AssetData} from 'metro';

import assetPathUtils from './assetPathUtils';
import fs from 'fs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @oncall react_native
*/

import type {AssetData} from 'metro/src/Assets';
import type {AssetData} from 'metro';

import assetPathUtils from './assetPathUtils';
import fs from 'fs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @oncall react_native
*/

import type {AssetData} from 'metro/src/Assets';
import type {AssetData} from 'metro';

import {
cleanAssetCatalog,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

import type {Server} from 'connect';
import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter';
import type {TerminalReportableEvent} from 'metro';

import {typeof createDevServerMiddleware as CreateDevServerMiddleware} from '@react-native-community/cli-server-api';

Expand Down
6 changes: 2 additions & 4 deletions packages/community-cli-plugin/src/commands/start/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
*/

import type {Config} from '@react-native-community/cli-types';
import type {TerminalReporter} from 'metro';
import type {Reporter} from 'metro/src/lib/reporting';
import type {TerminalReportableEvent} from 'metro/src/lib/TerminalReporter';
import type {Reporter, TerminalReportableEvent, TerminalReporter} from 'metro';

import createDevMiddlewareLogger from '../../utils/createDevMiddlewareLogger';
import isDevServerRunning from '../../utils/isDevServerRunning';
Expand Down Expand Up @@ -180,7 +178,7 @@ function getReporterImpl(
customLogReporterPath?: string,
): Class<TerminalReporter> {
if (customLogReporterPath == null) {
return require('metro/src/lib/TerminalReporter');
return require('metro').TerminalReporter;
}
try {
// First we let require resolve it, so we can require packages in node_modules
Expand Down
Loading