Created
March 18, 2021 15:33
-
-
Save acoyfellow/2779fb121fac0f32c7419e8dfede772d to your computer and use it in GitHub Desktop.
Example of how to initialize firebase@exp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { initializeApp } from 'firebase/app'; | |
import { getAuth, onAuthStateChanged } from "firebase/auth"; | |
import { getFirestore } from 'firebase/firestore'; | |
import { getStorage } from "firebase/storage"; | |
let ssrAuthed = window.ssrUser; | |
const firebaseConfig = { | |
// ... | |
}; | |
const firebase = window.firebase || initializeApp(firebaseConfig); | |
window.firebase = firebase; | |
const auth = getAuth(firebase); | |
const firestore = getFirestore(firebase); | |
const storage = getStorage(firebase); | |
onAuthStateChanged(auth, (u) => { | |
console.log({ ssrAuthed, u }); | |
}); | |
export { | |
firebase, | |
auth, | |
firestore, | |
storage | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you both. To @acoyfellow's point, there was just a bit update to SK and an update to Vite. I'm in the midst of that update, so perhaps this is an artifact of the swirl. I'll definitely try your solution if the update doesn't fix things.