Using module bundlers with Firebase

JavaScript module bundlers can do many things, but one of their most useful features is the ability to add and use external libraries in your code base. Module bundlers read import paths in your code and combine (bundle) your application-specific code with your imported library code.

From version 9 and higher, the Firebase JavaScript modular API is optimized to work with the optimization features of module bundlers to reduce the amount of Firebase code included in your final build.

import { initializeApp } from 'firebase/app';
import { getAuth, onAuthStateChanged,