Today We are Going To Solve Attempted import error: ‘firebase/app’ does not contain a default export (imported as ‘firebase’) in reactjs. Here we will Discuss All Possible Solutions and How this error Occurs So let’s get started with this Article.
Contents
How to Fix Attempted import error: ‘firebase/app’ does not contain a default export (imported as ‘firebase’) Error?
- How to Fix Attempted import error: ‘firebase/app’ does not contain a default export (imported as ‘firebase’) Error?
To Fix Attempted import error: ‘firebase/app’ does not contain a default export (imported as ‘firebase’) Error just Change firebase/app to firebase/compat/app. To solve this error you have to just change
import firebase from 'firebase/app'; import 'firebase/firestore'; import 'firebase/auth';
toimport firebase from 'firebase/compat/app'; import 'firebase/compat/firestore'; import 'firebase/compat/auth';
- Attempted import error: ‘firebase/app’ does not contain a default export (imported as ‘firebase’)
To Fix Attempted import error: ‘firebase/app’ does not contain a default export (imported as ‘firebase’) Error just Use /compat folder in your imports. You have to use /compat folder in your imports to solve this error.
import firebase from 'firebase/compat/app'; import 'firebase/compat/auth'; import 'firebase/compat/firestore';
Solution 1 : Change firebase/app to firebase/compat/app
To solve this error you have to just
change
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/auth';
to
import firebase from 'firebase/compat/app';
import 'firebase/compat/firestore';
import 'firebase/compat/auth';
Solution 2 : Use /compat folder in your imports
You have to use /compat folder in your imports to solve this error.
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
Conclusion
So these were all possible solutions to this error. I hope your error has been solved by this article. In the comments, tell us which solution worked? If you liked our article, please share it on your social media and comment on your suggestions. Thank you.
Also Read These Solutions
- unexpected disconnect while reading sideband packet fatal: the remote end hung up unexpectedly
- Using / for division is deprecated and will be removed in Dart Sass 2.0.0 in Nuxtjs
- accessible: module java.base does not “opens java.io” to unnamed module
- error: invalid command ‘bdist_wheel’
- Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow