Open wchesley opened 5 years ago
Check to see if you’re importing Firebase at the top of your component next to import React from ‘react’.
const db = firebase.firestore(); The first firebase shouldn’t be capitalized
The Firebase instance is exported from firebase.js as export default Firebase
changing the case causes firebase to become undefined.
In your ./src/firebase/db.js try adding the following import at the top.
import * as firebase from 'firebase';
Got this idea from stack overflow and comparing your code to mine.
well changing the import statement does change the error message:
Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app)
However, in firebase.js we have app.initializeApp(config);
I also tried moving all db.js logic into firebase.js and achieved the same results.
Try this below (: import * as firebase from 'firebase'; import 'firebase/firestore'; <--- add this line here to your code
Seem to point db.js towards the actual firebase library rather than my code to initialize firebase.
Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app).
But, changing the import statement to: `import * as firebase from './firebase' we get this:
Failed to compile
./src/firebase/db.js
Attempted import error: 'firestore' is not exported from './firebase' (imported as 'firebase').
I'm going to have to reread firestore docs before attempting to fix this again.
It didn't work for me either, just the red screen of death
On Sun, May 5, 2019, 1:21 PM Walker Chesley notifications@github.com wrote:
Seem to point db.js towards the actual firebase library rather than my code to initialize firebase.
Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app).
But, changing the import statement to: `import * as firebase from './firebase' we get this: ``` Failed to compile ./src/firebase/db.js Attempted import error: 'firestore' is not exported from './firebase' (imported as 'firebase').
I'm going to have to reread firestore docs before attempting to fix this again.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/wchesley/React-Pizza/issues/3#issuecomment-489450461, or mute the thread https://github.com/notifications/unsubscribe-auth/AKIHJXBF2BLW6YOK6ITUVDDPT4QTRANCNFSM4HAX7SEA .
Error code:
TypeError: _firebase__WEBPACK_IMPORTED_MODULE_0__.default.firestore is not a function
Error thrown in ./src/firebase/db.js Line 3:
const db = Firebase.firestore();