Remove src/* exports mapping (#57484)#57484
Closed
huntie wants to merge 3 commits into
Closed
Conversation
|
@huntie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D111034634. |
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
Summary: NOTE: Resubmission of D110890810. Replace `'react-native/Libraries/Core/InitializeCore'` with an explicit `'react-native/setup-env'` secondary export. This was previously a special-case path excluded from our ESLint warnings. It is now formalised. **Changes** - Add new `src/setup-env.js` entry point and `package.json` mapping. - Replace references in `packages/metro-config/` and `packages/community-cli-plugin/`. - Update `warn-on-deep-imports` ESLint rule. Changelog: [General][Added] - Add `'react-native/setup-env'` entry point. This replaces the previous side-effectful `'react-native/Libraries/Core/InitializeCore'`. [General][Deprecated] - Deprecate `'react-native/Libraries/Core/InitializeCore'`. Use `'react-native/setup-env'` instead. Reviewed By: rubennorte Differential Revision: D111022546
Summary: NOTE: Resubmission of D110488985. **Motivation** The public type for `Touchable` has zero overlap with its runtime value. This is an internal implementation object which is undocumented. https://www.internalfb.com/code/fbsource/[86267213ee84]/xplat/js/react-native-github/packages/react-native/Libraries/Components/Touchable/Touchable.d.ts?lines=18-24 https://www.internalfb.com/code/fbsource/[86267213ee84]/xplat/js/react-native-github/packages/react-native/Libraries/Components/Touchable/Touchable.js?lines=966-986 Replaces D110483989 / react#57419. **Impact** This is a **breaking change** with few open source consumers. The `onTouchStart` etc prop typings are part of `ViewProps` today, which is a suitable replacement. Across projects I've been testing for the Strict TypeScript API rollout, the only load bearing consumer was Uniwind — where I've sent a PR to address this. - uni-stack/uniwind#592. Changelog: [General][Breaking] - The `Touchable` root export (undocumented) is removed. If you are extending `Touchable` as a type, please use `ViewProps` instead. Reviewed By: rubennorte Differential Revision: D111022549
Summary: Follows up react#57277, going further to remove this entry point mapping entirely — D110911864 further supports that these import paths were never used externally (and in the first case, `src/private/` has always been an explicit name). **One caveat** `rn-tester` includes some runtime and Fantom test references to `'react-native/src/private/...'`. - This happens to continue working because we've not enabled `"exports"` resolution under Flow. - These can be classified as repo-local — motivation is simplifying/tightening the root `package.json` for open source. Changelog: [Internal] - (Covered by react#57277) Reviewed By: rubennorte Differential Revision: D111034634
|
This pull request has been merged in c165265. |
zeyap
pushed a commit
that referenced
this pull request
Jul 13, 2026
Summary: Pull Request resolved: #57484 Follows up #57277, going further to remove this entry point mapping entirely — D110911864 further supports that these import paths were never used externally (and in the first case, `src/private/` has always been an explicit name). **One caveat** `rn-tester` includes some runtime and Fantom test references to `'react-native/src/private/...'`. - This happens to continue working because we've not enabled `"exports"` resolution under Flow. - These can be classified as repo-local — motivation is simplifying/tightening the root `package.json` for open source. Changelog: [Internal] - (Covered by #57277) Reviewed By: rubennorte Differential Revision: D111034634 fbshipit-source-id: 4c80223dcf634201df9c77f8bde96dfb0c6f64f9
This was referenced Jul 14, 2026
meta-codesync Bot
pushed a commit
that referenced
this pull request
Jul 15, 2026
#57557) Summary: Pull Request resolved: #57557 Fresh projects **redbox on launch** — e.g.: ``` Failed to call into JavaScript module method RCTDeviceEventEmitter.emit(). Module has not been registered as callable. Registered callable JavaScript modules (n = 1): AppRegistry. ``` (The named module varies — `HMRClient.setup()`, `RCTDeviceEventEmitter.emit()` — it's whichever callable module native calls first.) `n = 1: AppRegistry` is the tell: **core initialization never runs**. ## Root cause (#57475) Core init runs via Metro's `serializer.getModulesRunBeforeMainModule`. Metro (`metro/src/lib/getAppendScripts.js`) only emits the run-before `__r()` for a module **already present in the bundle graph**, and silently skips it otherwise: ```js const paths = [...options.runBeforeMainModule, entryPoint]; for (const path of paths) { if (modules.some((module) => module.path === path)) { // only if already in the graph /* __r(moduleId) */ } } ``` **#57475 switched the run-before target from `Libraries/Core/InitializeCore` → `src/setup-env.js`. - `InitializeCore.js` **is** reachable (imported by `Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js`). - `src/setup-env.js` is imported by **nothing** → not in the graph → silently skipped → core init never runs. The two modules are functionally identical (both call `setUpDefaultReactNativeEnvironment().default()`), so only *reachability* changed. #57498 was cosmetic (same resolved file) and does not fix this. ### Evidence (bundle tail) | Run-before target | Bundle tail | Boots? | |---|---|---| | `setup-env` (current) | `__r(0);` | ❌ | | `InitializeCore` (this PR) | `__r(<InitializeCore>); __r(0);` | ✅ | Verified end-to-end via `test-release-local -t RNTestProject -p iOS`. Ruled out: Metro cache (cold `--reset-cache` identical), stale Metro, and #57484 (`./src/*` exports removal). Reproduces via the `react-native-community/cli` bundling path (OSS `react-native start`); internal Meta bundling is unaffected, which is why CI/internal stayed green. ## Scope — interim stopgap Only the **internal Metro bootstrap target** reverts to `InitializeCore`. The public `react-native/setup-env` entry point and its deprecation of `InitializeCore` are **unchanged**. The **durable fix** is to make `setup-env` graph-reachable (or make Metro treat `getModulesRunBeforeMainModule` entries as graph roots) — which will then allow `InitializeCore` to be removed as intended. cc huntie (`setup-env` stack owner). A cherry-pick of this is also up against `0.87-stable` (#57553). ## Changelog [General][Fixed] - Fix apps failing to boot ("... not registered as callable") caused by core init not running. Reviewed By: christophpurrer Differential Revision: D112002434 fbshipit-source-id: ea3559ef74d31f2c0f9af78aa0a020f4b322e7e0
react-native-bot
pushed a commit
that referenced
this pull request
Jul 15, 2026
#57557) Summary: Pull Request resolved: #57557 Fresh projects **redbox on launch** — e.g.: ``` Failed to call into JavaScript module method RCTDeviceEventEmitter.emit(). Module has not been registered as callable. Registered callable JavaScript modules (n = 1): AppRegistry. ``` (The named module varies — `HMRClient.setup()`, `RCTDeviceEventEmitter.emit()` — it's whichever callable module native calls first.) `n = 1: AppRegistry` is the tell: **core initialization never runs**. ## Root cause (#57475) Core init runs via Metro's `serializer.getModulesRunBeforeMainModule`. Metro (`metro/src/lib/getAppendScripts.js`) only emits the run-before `__r()` for a module **already present in the bundle graph**, and silently skips it otherwise: ```js const paths = [...options.runBeforeMainModule, entryPoint]; for (const path of paths) { if (modules.some((module) => module.path === path)) { // only if already in the graph /* __r(moduleId) */ } } ``` **#57475 switched the run-before target from `Libraries/Core/InitializeCore` → `src/setup-env.js`. - `InitializeCore.js` **is** reachable (imported by `Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js`). - `src/setup-env.js` is imported by **nothing** → not in the graph → silently skipped → core init never runs. The two modules are functionally identical (both call `setUpDefaultReactNativeEnvironment().default()`), so only *reachability* changed. #57498 was cosmetic (same resolved file) and does not fix this. ### Evidence (bundle tail) | Run-before target | Bundle tail | Boots? | |---|---|---| | `setup-env` (current) | `__r(0);` | ❌ | | `InitializeCore` (this PR) | `__r(<InitializeCore>); __r(0);` | ✅ | Verified end-to-end via `test-release-local -t RNTestProject -p iOS`. Ruled out: Metro cache (cold `--reset-cache` identical), stale Metro, and #57484 (`./src/*` exports removal). Reproduces via the `react-native-community/cli` bundling path (OSS `react-native start`); internal Meta bundling is unaffected, which is why CI/internal stayed green. ## Scope — interim stopgap Only the **internal Metro bootstrap target** reverts to `InitializeCore`. The public `react-native/setup-env` entry point and its deprecation of `InitializeCore` are **unchanged**. The **durable fix** is to make `setup-env` graph-reachable (or make Metro treat `getModulesRunBeforeMainModule` entries as graph roots) — which will then allow `InitializeCore` to be removed as intended. cc huntie (`setup-env` stack owner). A cherry-pick of this is also up against `0.87-stable` (#57553). ## Changelog [General][Fixed] - Fix apps failing to boot ("... not registered as callable") caused by core init not running. Reviewed By: christophpurrer Differential Revision: D112002434 fbshipit-source-id: ea3559ef74d31f2c0f9af78aa0a020f4b322e7e0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Follows up #57277, going further to remove this entry point mapping entirely — D110911864 further supports that these import paths were never used externally (and in the first case,
src/private/has always been an explicit name).One caveat
rn-testerincludes some runtime and Fantom test references to'react-native/src/private/...'."exports"resolution under Flow.package.jsonfor open source.Changelog:
[Internal] - (Covered by #57277)
Reviewed By: rubennorte
Differential Revision: D111034634