- Create vue.js app with
vue create your_vue_app_name
- Install Firebase npm module
npm install --save firebase
- create
config/firebase.js
file in src
dir
- Write the following code
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
import "firebase/performance";
import "firebase/messaging";
const firebaseConfig = {
// Firebase Config File
};
firebase.initializeApp(firebaseConfig);
firebase
.firestore()
.enablePersistence({ synchronizeTabs: !0 })
.catch(() => {
console.warn("DB offline support not available");
});
export default {
firestore: firebase.firestore(),
auth: firebase.auth(),
firebase: firebase,
notificationSupported: firebase.messaging.isSupported(),
messaging: firebase.messaging.isSupported() ? firebase.messaging() : null,
};
- Add your firebase config keys
- Import
config/firebase.js
vue component