Firebase is known as BAAS (backend-as-a-service), which is an infrastructure of Google. Firebase provides great access to developers and programmers to design apps and make their user base. It provides a real-time database, authentication option, hosting, etc. When you are using firebase, you may encounter the error “export ‘default’ (imported as ‘firebase’) was not found in ‘firebase/app’”.
To encounter the error is normal. Solving it is an important step, and we are here to help you resolve the error. We provide tips and solutions that you can simply implement. But before that, let’s figure out how you land up in trouble.
How the error warning pops up?
When you try to import firebase in a Vue app, you get the error message. Have a look at the code you are trying to import
import firebase from 'firebase/app' import 'firebase/auth' import 'firebase/firestore'
You get the error as soon as you import
export 'default' (imported as 'firebase') was not found in 'firebase/app'
When you get an error, you must be wondering how to tackle it. Have a look at the solution to fix the error
How to Fix the error “export ‘default’ (imported as ‘firebase’) was not found in ‘firebase/app’”
When you using Web SDK version 8 of firebase, you must be struggling hard to work on it. It happens as you have been using the version that is not updated, which results in the error. We have the best solution to fix the error in a simpler way.
Solution – Switch the version to 9
The error pops up when you use the 8 version. Keeping in mind the firebase document, you just need to update the dependency to v9 replacing the v8 beta. Your import statements need to be changed in order to use the version ‘compact’ of every import.
Before, you have version 8
import firebase from 'firebase/app'; import 'firebase/auth'; import 'firebase/firestore';
After, you have version 9 compat
// v9 compat packages are API compatible with v8 code import firebase from 'firebase/compat/app'; import 'firebase/compat/auth'; import 'firebase/compat/firestore';
This way, you can resolve the error.
In this post, we shed light on the error “export ‘default’ (imported as ‘firebase’) was not found in ‘firebase/app’” and how to tackle it. No matter how complex the error seems, the solution to fix this error is quite simple. You just need to implement the solution and say bye-bye to the error.
I hope you enjoyed it and find it helpful! I wish you luck! If you have any issues, feel free to mention your query in the comment box below! We would love to help you!