The following statement imports the default export from Firebase package
import firebase from "firebase"
The other 3 are imported for their side-effects only which "runs the module's global code, but doesn't actually import any values."
If you notice you don't use import and use anything from those packages. All Firebase services are accessed using the firebase.
namespace such as:
import firebase from 'firebase';
import 'firebase/firestore';
import 'firebase/auth';
const auth = firebase.auth()
const firestore = firebase.firestore()
Now if you remove import "firebase/auth"
, the Auth SDK won't be initialize (whatever it does under the hood) and the firebase.auth()
statement might throw an error that looks like:
firebase_compat_app__WEBPACK_IMPORTED_MODULE_0___default.a.auth is not a function
You can read more about imports at MDN.