codingishard
codingishard

Reputation: 33

Firebase authentication with React

Can anyone help with this code? I am trying to do a website project with React and firebase authentication. When I try to run the code, React shows an error => Module not found: Error: Package path . is not exported from package

import firebase from "firebase";

const firebaseConfig = {
  apiKey: "...",
  authDomain: "...",
  projectId: "...",
  storageBucket: "...",
  messagingSenderId: "...",
  appId: "...",
  measurementId: "..."
};

const firebaseApp = firebase.initializeApp(firebaseConfig);
const db = firebaseApp.firestore();
const auth = firebase.auth();
const provider = new firebase.auth.GoogleAuthProvider();
const storage = firebase.storage();

export { auth, provider, storage };
export default db;

I have tried multiple times of changing the import statement but its not working

Upvotes: 0

Views: 57

Answers (1)

mguddeti
mguddeti

Reputation: 466

Try this if it's before version 8: import firebase from 'firebase/app'; as your Firebase Import.

Version 9 and above: import firebase from 'firebase/compat/app';

Upvotes: 2

Related Questions