Skip to content Skip to sidebar Skip to footer

Attempted Import Error: 'app' Is Not Exported From 'firebase/app' (imported As 'firebase')

Encountered a very weird issue. When trying to import firebase, I got the following error: ./node_modules/firebaseui/dist/esm.js Attempted import error: 'app' is not exported from

Solution 1:

Unfortunately, you've upgraded your "firebase" dependency to 8.0.0 but the "firebaseui" dependency doesn't support it yet. You will have to temporarily downgrade firebase to version 7.24.0 until firebaseui supports the breaking changes in 8.0.0.


Solution 2:

Its an update issue, while you can fix how you import firebase, you can't fix how it's imported imported in libraries you use, you'll have wait for those library to be update.

Before 8.0.0

import * as firebase from 'firebase/app'

After 8.0.0

import firebase from 'firebase/app'

Library's like FirebaseUI authentication


Solution 3:

Firebase version I was using Firebase>8.0.0
Line of code I was using import * as firebase from 'firebase/app'; this import works for Firebase<8.0.0

Please go and use this import firebase from 'firebase/app';
if you are using firebase>8.0.0 as of now (4th Aug 2021) things might change on later versions.
This is because you are using the wrong line of code, nothing wrong with the system.
Go and check the package.json file on your project folder.

Check here package.json

Checking firebase version on package.json file


Solution 4:

When I installed firebase, by default it has installed the version of 9.0.0. And I see the mentioned error but when I changed it to 8.9.1 and imported it as below it worked for me.

import firebase from 'firebase/app'


Solution 5:

First determine your firebase version:

firebase --version

If you are using version 9, replace this line

import firebase from "firebase/app"

with

import firebase from 'firebase/compat/app'

Reference: https://exerror.com/attempted-import-error-firebase-app-does-not-contain-a-default-export-imported-as-firebase/


Post a Comment for "Attempted Import Error: 'app' Is Not Exported From 'firebase/app' (imported As 'firebase')"