firebase.auth is not a function
I fixed this by deleting my node_modules
directory and reinstalling everything.
Also I'm importing firebase like so:
import firebase from 'firebase'
require('firebase/auth')
The problem wasn't with the node_modules
, it was with the way that you were importing the component.
When you export a component ES6 way, you normally do export default () => { console.log('default component export'); };
default
is the keyword here, when you import a component ES6 way like import firebase from 'firebase'
it's grabbing the default
property from the exported object.
Keeping in mind the above example, here's what you've done wrong.
Using ES6:
import * as firebase from 'firebase'
console.log(firebase.auth) // Undefined
console.log(firebase.default.auth) // Function
Using ES5:
var firebase = require('firebase')
console.log(firebase.auth) // Undefined
console.log(firebase.default.auth) // Function
Note the .default