donpuerto
3 years ago
364
3
Vue

How to declare global variable using Vue CLI template

Posted 3 years ago by donpuerto

I want these variables to be available in a component and to its sub component. Any idea everyone? thanks

var firebase = require('firebase')
// Initialize Firebase
var config = {
    apiKey: "AIzaSyD0mwJPOZTK9oS5lyQqHoBPxwVQHkbs",
    authDomain: "vuefirebasedemo.firebaseapp.com",
    databaseURL: "https://vuefirebasedemo.firebaseio.com",
    storageBucket: "vuefirebasedemo.appspot.com",
    messagingSenderId: "670332486376"
};

firebase.initializeApp(config);
var db = firebase.database()

Error

Uncaught Error: Firebase App named '[DEFAULT]' already exists.

Please sign in or create an account to participate in this conversation.