From 1486b31b2bc140208d8d71898f5cb37b507b4f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Wed, 20 Oct 2021 04:04:36 -0700 Subject: [PATCH] Re-apply: [RN] Make runtime initialization from React renderers a no-op Summary: Changelog: [internal] Reviewed By: yungsters Differential Revision: D31760907 fbshipit-source-id: ba145a30ead52abeb8affca84c3dec21dfefe30c --- .../ReactPrivate/ReactNativePrivateInitializeCore.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js b/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js index e34e6271f2f..975e1735379 100644 --- a/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js +++ b/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js @@ -8,4 +8,13 @@ * @flow strict-local */ -import '../Core/InitializeCore'; +// TODO: Remove this module when the import is removed from the React renderers. + +// This module is used by React to initialize the React Native runtime, +// but it is now a no-op. + +// This is redundant because all React Native apps are already executing +// `InitializeCore` before the entrypoint of the JS bundle +// (see https://github.com/react-native-community/cli/blob/e1da64317a1178c2b262d82c2f14210cdfa3ebe1/packages/cli-plugin-metro/src/tools/loadMetroConfig.ts#L93) +// and importing it unconditionally from React only prevents users from +// customizing what they want to include in their apps (re: app size).