errors.ts:91 Uncaught FirebaseError: Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app). code example
Example 1: Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app).
if (!firebase.apps.length) {
firebase.initializeApp({});
}
Example 2: firebaseError: Firebase: Firebase App named '[DEFAULT'] already exists (app/duplicate-app).
import * as firebase from "firebase";
const config = {...};
export default !firebase.apps.length ? firebase.initializeApp(config) : firebase.app();
import firebase from '../firebase';
...
console.log(firebase.name);
console.log(firebase.database());
Example 3: Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app).
import * as firebase from "firebase";
const config = {...};
export default !firebase.apps.length ? firebase.initializeApp(config) : firebase.app();
import firebase from '../firebase';
...
console.log(firebase.name);