We know that Firebase is a mobile and webapplication development platform. Many app developers
started using Firebase in their project from when it is released. To install Firebase as a dependency in
your project some steps are there.
First install Firebase using npm install command.
In the main.js file add the below lines of code.
import App from './App.vue'
import * as firebase from 'firebase'
import { store } from './store/store'
const config = {
apiKey: "xxxxxxx",
authDomain: "xxxxxxx",
databaseURL: "xxxxxxx",
storageBucket: "xxxxxxxx",
messagingSenderId: "xxxxxxx"
};
firebase.initializeApp(config);
Vue.prototype.$firebase = firebase;
new Vue({
el: '#app',
store,
render: h => h(App)
})
Alternatively you can add the firebase credentials in an external js file and then import it in the main.js
file as shown below.
Config.js
apiKey: "xxxxxxx",
authDomain: "xxxxxxx",
databaseURL: "xxxxxxx",
storageBucket: "xxxxxxxx",
messagingSenderId: "xxxxxxx"