Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  150] [ 7]  / answers: 1 / hits: 164140  / 6 Years ago, sat, february 3, 2018, 12:00:00

I am using Webpack with firebase and firebase-admin.


To install firebase I ran:


npm install --save firebase

I am importing firebase using:


import * as firebase from 'firebase/app'
import 'firebase/auth'

I also tried:


import * as firebase from 'firebase'

And I tried:


const firebase = require('firebase')

As suggested in web get started guide.


However, when I try to use firebase.auth() I get an error:



console.js:32 TypeError: firebase.auth is not a function



When I use the debugger to inspect firebase I see that it in fact does not have an auth function:


> firebase
{__esModule: true, initializeApp: ƒ, app: ƒ, Promise: ƒ, …}

How can I get auth() included as a function using webpack?


More From » reactjs

 Answers
300

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')

[#55281] Tuesday, January 30, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bradleymoisesy

Total Points: 121
Total Questions: 105
Total Answers: 95

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
bradleymoisesy questions
Wed, Dec 22, 21, 00:00, 3 Years ago
Tue, Jun 1, 21, 00:00, 3 Years ago
Thu, Jun 11, 20, 00:00, 4 Years ago
Thu, Jan 16, 20, 00:00, 4 Years ago
;