Remove explicit React Native entry point by hsubox76 · Pull Request #7138 · firebase/firebase-js-sdk (original) (raw)
DO NOT MERGE until 6/20. This is a breaking change and must be released with a major version. It is expected to release with the next major version of the SDK in June 2023.
Remove firebase/auth/react-native entry point. The React Native bundle should be automatically picked up by React Native build tools which recognize the react-native fields in package.json (at the top level and in exports). Firestore already does this.
The result is that users will not need to remember to use a special path when importing auth in React Native.
Test: I've tested this with an Expo project and it works. One caveat is there's a common pattern where users override Metro's default resolver and spread the old defaultResolver, not realizing that this removes the react-native field from resolverMainFields as Metro's default config is platform agnostic. See facebook/metro#807
If users run into this issue we need to remind them that this kind of Metro config modification:
exports.resolver = {
...defaultResolver,
sourceExts: [
...defaultResolver.sourceExts,
"cjs",
],
};
has unexpected results and what they really want to do is:
exports.resolver = {
sourceExts: [
...defaultResolver.sourceExts,
"cjs",
],
};
as their custom metro config will automatically extend existing defaults without the user having to include them explicitly.
The result of doing it the wrong way (the first example) is that Metro will grab the browser bundle instead of the one specified in the package.json react-native field. See #7115 for an example of a Firestore user having an issue with this (Firestore is currently the only other product with a specific react native bundle).