I am encountering an issue while setting up Vuefire and Firebase in my application. The error that I see in the console is:
FirebaseError: Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app).
at initializeApp (webpack-internal:///./node_modules/@firebase/app/dist/index.cjs.js:377:33)
at Object.firebase.initializeApp (webpack-internal:///./node_modules/@firebase/app/dist/index.cjs.js:667:26)
at eval (webpack-internal:///./src/db.js:28:70)
at Module../src/db.js (http://localhost:8080/js/about.js:323:1)
at __webpack_require__ (http://localhost:8080/js/app.js:854:30)
at fn (http://localhost:8080/js/app.js:151:20)
at eval (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/Photos.vue?vue&type=script&lang=js&:2:61)
at Module../node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/Photos.vue?vue&type=script&lang=js& (http://localhost:8080/js/about.js:167:1)
at __webpack_require__ (http://localhost:8080/js/app.js:854:30)
at fn (http://localhost:8080/js/app.js:151:20)
Below is the snippet from my db.js
file:
import * as firebase from 'firebase/app'
// Add the Firebase products that you want to use
import 'firebase/auth'
import 'firebase/firestore'
const firebaseConfig = {
apiKey: 'xxx',
authDomain: 'xxx',
databaseURL: 'xxx',
projectId: 'xxx',
storageBucket: 'xxx',
messagingSenderId: 'xxx',
appId: 'xxx'
}
// Get a Firestore instance
export const db = firebase.initializeApp({ projectId: firebaseConfig.projectId }).firestore()
// Use Auth module
export const auth = firebase.initializeApp(firebaseConfig).auth()
// Export types that exist in Firestore
// Assuming we might want to use these features later
const { Timestamp, GeoPoint } = firebase.firestore
export { Timestamp, GeoPoint }
Thank you for any assistance!