Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make runtime initialization from React renderers a no-op
Summary: This module is imported by all flavors of the React Native renderers (dev/prod, Fabric/Paper, etc.), which itself imports `InitializeCore`. This is effectively a no-op in most React Native apps because Metro adds it as a module to execute before the entrypoint of the bundle. This import would be harmless if all React Native apps included all polyfills and globals, but some of them don't want to include everything and instead of importing `InitializeCore` they import individual setup functions (like `setupXhr`). Having this automatic import in the renderer defeats that purpose (most importantly for app size), so we should remove it. The main motivation for this change is to increase the number (and spec-compliance) of Web APIs that are supported out of the box without adding that cost to apps that choose not to use some of them (see #30188 (comment)). Changelog: [General][Removed] Breaking: Removed initialization of React Native polyfills and global variables from React renderers. Note: this will only be a breaking change for apps not using the React Native CLI, Expo nor have a Metro configuration that executes `InitializeCore` automatically before the bundle EntryPoint. Reviewed By: yungsters Differential Revision: D31472153 fbshipit-source-id: 92eb113c83f77dbe414869fbce152a22f3617dcb
- Loading branch information