Skip to content

Commit

Permalink
fix: cannot find module react-native-*/Libraries/Core/InitializeCore (
Browse files Browse the repository at this point in the history
#42875)

Summary:
`react-native/community-cli-plugin` is unable to resolve out-of-tree platforms in monorepos because the package may not be hoisted to the same location. For example, if `react-native/community-cli-plugin` was hoisted:

```
/~/node_modules/react-native/community-cli-plugin/dist/utils
```

It may never find `react-native-macos` if it wasn't hoisted:

```
/~/packages/my-app/node_modules/react-native-macos
```

## Changelog:

[GENERAL] [FIXED] - Fix `react-native/community-cli-plugin` is unable to resolve out-of-tree platforms in monorepos

Pull Request resolved: #42875

Test Plan: Tested in an internal project.

Reviewed By: cipolleschi

Differential Revision: D53426607

Pulled By: robhogan

fbshipit-source-id: 29b9fe92d5773d0160bba375d2e92ec688652e3e
  • Loading branch information
tido64 authored and facebook-github-bot committed Feb 5, 2024
1 parent 48a19d7 commit e350859
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/community-cli-plugin/src/utils/loadMetroConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function getOverrideConfig(
...outOfTreePlatforms.map(platform =>
require.resolve(
`${ctx.platforms[platform].npmPackageName}/Libraries/Core/InitializeCore`,
{paths: [ctx.root]},
),
),
],
Expand Down

0 comments on commit e350859

Please sign in to comment.