Max Kurtz
Max Kurtz

Reputation: 478

Can't get rid of message When deploying Firebase apps to production, it is advisable to only import the individual SDK components you intend to use

I'm trying to use Firebase in my web project, and I can't understand how it works. I do:

import app from "firebase/app"; //1
import firebase from 'firebase'; //2
console.log(app === firebase);  //3

it outputs true. If I use 2 string my code to get data from firebase works and I get message about not using proper SDK in production If I use 1 string I get an error from:

app.initializeApp(firebaseConfig);
const db = app.firestore();

Uncaught TypeError: firebase_app__WEBPACK_IMPORTED_MODULE_0___default.a.firestore is not a function

Please help me to sort out how to fix this.

Upvotes: 0

Views: 33

Answers (1)

Max Kurtz
Max Kurtz

Reputation: 478

I've got it, webpack is in charge. It wraps imported modules, that's why they are equal. Though, don't know how to optimize my module loads using webpack and firebase simultaneously.

Upvotes: 1

Related Questions