i am tryng to put firebase in my project i have tried everthing, it returns a error code 500

Viewed 40
import * as firebase from 'firebase';
import '@react-native-firebase/auth'


const firebaseConfig = {
  apiKey: "your-key-here",
  authDomain: "your-name-here.firebaseapp.com",
  projectId: "your-id-here",
  storageBucket: "your-name-here.appspot.com",
  messagingSenderId: "0000000000",
  appId: "000000000",
  measurementId: "G-XXXXXXXXXXX"
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
export default fi

rebase;

it returns with However, this package itself specifies a main module field that could not be resolved (C:\Users\brock\Desktop\react-native\insta-app\node_modules\firebase\index. Indeed, none of these files exist:

I am trying to create a login system it doesnt seem to wanna work

1 Answers
import * as firebase from "firebase";
import "@firebase/auth";
import "@firebase/firestore";

const firebaseConfig = {
  apiKey: "your-key-here",
  authDomain: "your-name-here.firebaseapp.com",
  projectId: "your-id-here",
  storageBucket: "your-name-here.appspot.com",
  messagingSenderId: "0000000000",
  appId: "000000000",
  measurementId: "G-XXXXXXXXXXX"
};
  
  if (firebase.apps.length === 0) {
     firebase.initializeApp(firebaseConfig);
  }

Always works for me.

Related