Integration with firebase giving 'main' module not found error

Please provide the following:

  1. SDK Version:45.0.0
  2. Platforms(Android/iOS/web/all): all
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I am trying firebase integration with expo but hitting the below error as soon firebase is imported.

Error message:
Error: While trying to resolve module idb from file C:\exampleApp\node_modules\@firebase\app\dist\esm\index.esm2017.js, the package C:\exampleApp\node_modules\idb\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (C:\exampleApp\node_modules\idb\build\index.cjs. Indeed, none of these files exist:

Package.json

“dependencies”: {
“expo”: “~45.0.0”,
“expo-status-bar”: “~1.3.0”,
“firebase”: “^9.9.2”,
“react”: “17.0.2”,
“react-dom”: “17.0.2”,
“react-native”: “0.68.2”,
“react-native-web”: “0.17.7”
},

App.js

mport { StatusBar } from ‘expo-status-bar’;
import { StyleSheet, Text, View } from ‘react-native’;
import { fireBaseApp } from “./firebase”;

export default function App() {
return (

**** Testing 2 ***


);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: ‘#fff’,
alignItems: ‘center’,
justifyContent: ‘center’,
},
});

firebase.js
import { initializeApp } from “firebase/app”;

// Initialize Firebase (
const firebaseConfig = {
apiKey: “AXXXXSyCxzsrrcQyyyyyyyxxxyyyvN4gghK2JX0”,
authDomain: “aabba.aaa.com”,
projectId: “9678babb”,
storageBucket: “9xybx6.appspot.com”,
messagingSenderId: “65802xxxxxx”,
appId: “1:98579842751827:web:94d1xxxxefecec6cc92”
};

const fireBaseApp = initializeApp(firebaseConfig);

export {fireBaseApp}

Hey @mduntoor, it seems like this is a new Firebase JS SDK release that breaks compatibility with react-native. A workaround for this is to downgrade the firebase dependency version to 9.6.2.

You can install it npm install firebase@9.6.2.