It looks like you are using the Firebase SDK 8 code but probably has installed the Firebase SDK 9 version. Your code should look like this with the new SDK:
import { getFirestore } from "firebase/firestore";
import { initializeApp } from "firebase/app";
import { getAuth} from "firebase/auth";
const firebaseConfig = {
apiKey: "x",
authDomain: "x",
projectId: "x",
storageBucket: "x",
messagingSenderId: "x",
appId: "x",
};
const app = initializeApp(firebaseConfig);
const db = getFirestore();
const auth = getAuth();
export { db, auth };
Here you can find more about the migration to the SDK 9 version.
Here is an example how to use the new SDK 9 with collections:
import { collection, onSnapshot } from "firebase/firestore";
const unsubscribe = onSnapshot(collection(db, "cities"), () => {
// Respond to data
// ...
});
// Later ...
// Stop listening to changes
unsubscribe();