I'm trying to import firebase in a Vue 2 app, but I'm running into this annoying issue.
My imports look like:
import firebase from 'firebase/app'
import 'firebase/auth'
import 'firebase/firestore'
but when I serve it, I get:
export 'default' (imported as 'firebase') was not found in 'firebase/app'
...and my views don't render or route.
My version of firebase is 9.0.0 off of npm.
To Solve export 'default' (imported as 'firebase') was not found in 'firebase/app' Error According to firebase documents: Update imports to v9 compat. In order to keep your code functioning after updating your dependency from v8 to v9 beta, change your import statements to use the “compat” version of each import.
To Solve export 'default' (imported as 'Vue') was not found in 'vue' Error You just need to update Vue loader to its latest version and which is 15.10. 0 You need to run the following command in your terminal: npm i [email protected] And now, Your error must be solved.
: Firebase 'firebase/app' does not contain a default export (imported as 'firebase'). I am trying to implement a login, logout to my react project, I keep getting this error, I read that i need to downgrade to an older version but not sure how, tried different version but got different errors
Uncaught FirebaseError: Firebase: No Firebase App ' [DEFAULT]' has been created - call Firebase App.initializeApp () (app/no-app). For those getting similar error on version 9 Firebase, make sure to change your path to: import firebase from 'firebase/compat/app'; import 'firebase/compat/auth'; import 'firebase/compat/firestore'; ...
If you’re a startup, an indie developer or just working on some side project in Vue JS, chances are that you will be thinking of using Firebase for storage. This might very well be a good idea: Firebase is really easy to use and has quite a generous free plan.
Only users with topic management privileges can see it. Using a fresh PWA starter kit, I install Firebase following this tutorial. It used to work with previous projects (2 weeks ago), but now 'import Firebase from ‘firebase’ returns an error : export ‘default’ (imported as ‘Firebase’) was not found in 'firebase’.
Due to release of Firebase SDK Version 9 on 25th August 2021, many users using Firebase Web SDK version 8 are struggling with the same issue.
According to the documentation, Apps currently using Firebase Web SDK version 8 or earlier should consider migrating to version 9 as follows:
Before: version 8 (Old)
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
After: version 9 compat (New)
// v9 compat packages are API compatible with v8 code
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
Due to Doug Stevenson's suggestion to check my firebase version, I ended up checking firebase's upgrade docs and found this https://firebase.google.com/docs/web/modular-upgrade
Following the instructions there (changing the paths from firebase/x to firebase/compat/x) fixed my issue perfectly. Thank you all, and I hope any other clueless folk like myself confused by the new format can be helped by this post.
Due to release of Firebase SDK Version 9 on 25th August 2021, many users using Firebase Web SDK version 8 are struggling with the same issue.
According to the documentation, Apps currently using Firebase Web SDK version 8 or earlier should consider migrating to version 9 as follows:
Before: version 8 (Old)
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
After: version 9 compat (New)
// v9 compat packages are API compatible with v8 code
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
According to firebase documents: Update imports to v9 compat. In order to keep your code functioning after updating your dependency from v8 to v9 beta, change your import statements to use the “compat” version of each import. For example:
Before: version 8
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/firestore';
import "firebase/database";
import "firebase/storage";
After: 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';
import "firebase/compat/database";
import "firebase/compat/storage";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With