I'm using firebase for a SvelteKit project. I'm getting the following error only after reloading:
getApp is not defined
from the file /src/routes/admin/index.svelte:
import { initializeApp, getApps, getApp } from "firebase/app";
import { getFirestore } from "firebase/firestore";
const firebaseConfig = {
// (config info)
};
const firebaseApp =
(getApps().length === 0 ? initializeApp(firebaseConfig) : getApp());
const db = getFirestore();
const colRef = collection(db, "questions");
Why does firebase work until I reload? I'm guessing it's something to do with the fact that only the first page load is server rendered? Does getApp() not work on the client?