Firebase App named ‘[DEFAULT]’ already exists (app/duplicate-app)
1 min readSep 17, 2020
There are two types of error cases when you dealing firebase initiation with separation with moduling
Firebase App named '[DEFAULT]' already exists (app/duplicate-app)
It means You tried to initiate firebase duplicated.
Error: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp()
It means You need to initiate firebase before using.
When you using firebase in several modules, and you’d tried to init firebase in each module. You would be faced with those errors.
So, you’d better make a file for the only purpose of initiating firebase like this.
// firebaseInit.tsimport firebase from "firebase/app"
import { firebaseConfig } from "./const"export default !firebase.apps.length ? firebase.initializeApp(firebaseConfig) : firebase.app();
And import this file whereas you need to use firebase object.