I am currently working on a vue project and I am attempting to integrate firebase. However, I have encountered an issue where my other JavaScript files like auth.js are utilizing firebase before it is properly initialized in my main.js file (which acts as the entry point for webpack) due to using the vue-cli with the webpack template.
The error message that I am receiving states:
Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app).
Below is the beginning section of my main.js file:
// main.js
import Vue from 'vue';
import firebase from 'firebase';
// import firebaseui from 'firebaseui';
import VueFire from 'vuefire';
import App from './App';
import router from './router';
import database from './js/database';
Vue.use(VueFire);
const config = {
apiKey: '***',
authDomain: '***',
databaseURL: '***',
storageBucket: '***',
messagingSenderId: '***',
};
firebase.initializeApp(config);
database.init();
This is my first experience working with firebase, any insights into what could be causing this issue?