Angularfire: "export 'firestore' (imported as 'firebase') was not found in 'firebase/app'

Created on 15 May 2018  路  3Comments  路  Source: angular/angularfire

i imported firebase app but sitll got this error
import * as firebase from 'firebase/app';

"export 'firestore' (imported as 'firebase') was not found in 'firebase/app'

"angularfire2": "^5.0.0-rc.8.0",
"firebase": "^5.0.2",

Most helpful comment

Try to replace it for

import { firebase } from '@firebase/app'
import '@firebase/auth'

I'm assuming that you're trying to load the auth module, if not, you might wanna try these...

import '@firebase/auth' - Firebase Authentication.
import '@firebase/firestore' - The Cloud Firestore Database.
import '@firebase/firestorage' - Firebase Storage.

Alternatively, you can also try to import it all...

import * as firebase from 'firebase';

Although it's not recommended to import everything at once.

All 3 comments

Try to replace it for

import { firebase } from '@firebase/app'
import '@firebase/auth'

I'm assuming that you're trying to load the auth module, if not, you might wanna try these...

import '@firebase/auth' - Firebase Authentication.
import '@firebase/firestore' - The Cloud Firestore Database.
import '@firebase/firestorage' - Firebase Storage.

Alternatively, you can also try to import it all...

import * as firebase from 'firebase';

Although it's not recommended to import everything at once.

@renansigolo I'm also having this warning. To apply your comment, I had to install @ firebase/app, @firebase/auth which was dependencies of "firebase". I have doubt that this is right approach. Is there any related issues you know with importing from firebase/app?

Even though you're able to import the lib as a whole with import * as firebase from 'firebase'; it's recommended to only import the module that you will address.

Normally I create a service for each kind of module and at this service I will handle everything related to it.

So for example, you can create an auth service and import the module with import '@firebase/auth' then when you need to handle any sort of authentication you'll be using the service instead of importing firebase again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

martinyoussef picture martinyoussef  路  3Comments

KLiFF2606 picture KLiFF2606  路  3Comments

cre8 picture cre8  路  3Comments

DennisSmolek picture DennisSmolek  路  3Comments

aucevica picture aucevica  路  3Comments