You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default to ignoring cached Metro bundle when offline (#38076)
Summary:
Pull Request resolved: #38076
Changelog: [Android][Breaking] Default to ignoring cached Metro bundle when offline
Currently, on Android, if we can't find a Metro server at startup, we try to run the last cached Metro bundle instead of the prebuilt bundle asset in the APK. This is inconsistent with the iOS behaviour, and breaks bundle features that rely on a runtime Metro connection to work correctly - such as HTTP asset loading and lazy bundling (which is the default as of D43600054).
Here we change the default for `ReactInstanceManager`'s `useFallbackBundle` property to `true`, which has the effect of ignoring the cached Metro bundle.
This is a **breaking change** because some developers' workflows might depend on performing a build while connected to a Metro instance, then using the app standalone without access to Metro. This may be exacerbated by the fact that the RN Gradle plugin [skips including a prebuilt bundle in debug builds](https://github.com/facebook/react-native/blob/eaafc260c14674bfbf7ce3a647404c70d546854f/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt#L54). This means that, out of the box, debug builds of Android RN apps will only start if connected to Metro. (Contrast with iOS where a "fallback" bundle *is* included out of the box.)
We recommend that developers always connect to a Metro server in development, and perform a release build for standalone use. Alternatively, developers can use `ReactInstanceManager.setUseFallbackBundle(false)` to restore the old behaviour.
Reviewed By: javache, luluwu2032
Differential Revision: D47021957
fbshipit-source-id: 43ce8078ec95f5d65790b56f4d3dfa4f6a4e9023
0 commit comments