Parece que está utilizando el código Firebase SDK 8, pero probablemente haya instalado la versión Firebase SDK 9. Su código debería verse así con el nuevo 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 };Aquí puede encontrar más información sobre la migración a la versión SDK 9.
Aquí hay un ejemplo de cómo usar el nuevo SDK 9 con collections :
import { collection, onSnapshot } from "firebase/firestore"; const unsubscribe = onSnapshot(collection(db, "cities"), () => { // Respond to data // ... }); // Later ... // Stop listening to changes unsubscribe();