Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue 2; export 'default' (imported as 'firebase') was not found in 'firebase/app'

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.

like image 263
T. Lerner Avatar asked Aug 25 '21 20:08

T. Lerner


People also ask

Was not found in firebase possible exports default?

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.

What was not found in Vue?

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.

Is there a default export for Firebase app?

: 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

How to fix uncaught Firebase error [default] has been created?

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'; ...

Should you use Firebase for storage in Vue JS?

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.

Who can see firebase in a PWA project?

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’.


Video Answer


4 Answers

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';
like image 50
Utkarsh Avatar answered Sep 17 '22 20:09

Utkarsh


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.

like image 29
T. Lerner Avatar answered Oct 18 '22 04:10

T. Lerner


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';
like image 52
utkarsh404 Avatar answered Oct 18 '22 03:10

utkarsh404


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";
like image 3
blaaool Avatar answered Oct 18 '22 03:10

blaaool