Hi I get following error in chrome console:
Uncaught TypeError: _firebase2.default is not a constructor
when I use following code in Fire.vue (webpack vue-loader) component:
var db = new Firebase(this.rootUrl)
Here is the full code of my Fire.vue:
<template lang="jade">
h2 Hello from: {{ component_name }}
</template>
<script>
import Vue from 'vue'
import Firebase from 'firebase'
Vue.prototype.$consoleLog = function (args) { console.log(args) }
export default {
props: {
rootUrl: {
default: 'https://boiling-heat...', // here will be url of database
type: String
}
},
data () {
return {
component_name: 'Firebase component!'
}
},
ready () {
var db = new Firebase(this.rootUrl) // <- this causes error
this.$consoleLog(db)
}
}
</script>
It has nothing to do with my rootUrl
property, it's just to keep the code clean. I'm not sure if that is caused by error in Firebase package or did i miss something when importing it for my component.
is not a constructor
means Firebase
object should not be called with new
keyword.
A quick glance at the npm module page gives the following example of Fireabse initialization:
var firebase = require('firebase');
var app = firebase.intializeApp({ ... });