const db=firebaseApp.firestore();
export default db;
the error occurs in this line of code Ive tried importing everything and every possible method but still the error shows up everytime.
the full code is
import * as firebase from "firebase/app";
//import firebase from 'firebase/app';
import "firebase/firestore";
import 'firebase/auth';
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseApp = firebase.initializeApp({
apiKey: "",
authDomain: "",
databaseURL: '',
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: ""
});
const db=firebaseApp.firestore();
export default db;
CodePudding user response:
It seems you are using Firebase Modular SDK V9.0.0
which has a completely new syntax. If you wish to use existing syntax, change your imports to compat
version:
import firebase from "firebase/compat/app";
import "firebase/compat/firestore";
import 'firebase/compat/auth';
However I'd recommend upgrading to Modular SDK syntax because has supports tree-shaking and will be lighter than existing version. Checkout this Firecast to learn more about new syntax for Firestore: