Commit 2765a4c
committed
[0.87] Bootstrap Metro from InitializeCore until setup-env is graph-reachable
Summary:
Fresh 0.87 projects redbox on launch with:
Failed to call into JavaScript module method RCTDeviceEventEmitter.emit().
Module has not been registered as callable.
Registered callable JavaScript modules (n = 1): AppRegistry.
Core initialization never runs. Metro's `getModulesRunBeforeMainModule`
(see metro/src/lib/getAppendScripts.js) only emits the run-before `__r()`
call for a module that is *already present in the bundle graph*, and
silently skips it otherwise.
to `src/setup-env.js`. `InitializeCore` is reachable in the graph (imported
by `Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js`), but
`src/setup-env.js` is imported by nothing, so Metro skips it and core init
never runs. The two modules are functionally identical (both call
`setUpDefaultReactNativeEnvironment().default()`).
Evidence (bundle tail):
- setup-env target: `__r(0);` (broken)
- InitializeCore target: `__r(110); __r(0);` (fixed)
This is an INTERIM stopgap to unblock the 0.87 RC. It only changes the
internal Metro bootstrap target back to `InitializeCore`; the public
`react-native/setup-env` entry point and its deprecation of InitializeCore
are unchanged. The proper fix (make `setup-env` graph-reachable, or make
Metro treat `getModulesRunBeforeMainModule` entries as graph roots) should
land on main and supersede this.
Changelog:
[General][Fixed] - Fix apps failing to boot ("RCTDeviceEventEmitter not
registered as callable") due to core init not running.
Test Plan:
- `yarn test-release-local -t RNTestProject -p iOS`: app boots without redbox.
- Bundle tail now contains `__r(<InitializeCore>); __r(0);` instead of just `__r(0);`.1 parent 6c5b9b1 commit 2765a4c
2 files changed
Lines changed: 4 additions & 4 deletions
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
0 commit comments