I am trying to connect to Firebase.
Code from firebase.js:
import * as firebase from "firebase/compat/app";
const firebaseConfig = {
apiKey: "***",
authDomain: "***",
projectId: "***",
storageBucket: "***",
messagingSenderId: "***",
appId: "***",
};
const app = !firebase.apps.length
? firebase.initializeApp(firebaseConfig)
: firebase.app();
const db = app.firestore();
const auth = app.auth();
const provider = new firebase.auth.GoogleAuthProvider();
export { db, auth, provider };
CodePudding user response:
As I said in my comment on your other thread, firebase imports have changed recently. Try to change fribase
to firebase/compat/app
Documentation
CodePudding user response:
You're missing imports for Firestore (as the error mentions) and Authentication.
import * as firebase from "firebase/compat/app";
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
Also see the documentation on updating imports to v9 compat.