The firebase packages are too big.
I'm using only firebase/app (required, and small enough) and firebase/auth (enormous):
All I want is to use firebase to let my users login through google/facebook/twitter/email.
The gzipped build output is 58.52Kb.

It seems like webpack and Terser cannot minimize the firebase library by removing unnecessary code.
Other libraries like material-ui recommend to import only the code that we need, each function/class being in its own file
import ArrowIcon from "@material-ui/icons/ArrowDropDown" // GOOD
import {ArrowIcon} from "@material-ui/icons" // BAD: you're importing all icons
Can you update firebase so we can only import the bits we care about from firebase/auth, instead of always importing the whole thing ?
Or do you know of a trick to let webpack remove all the unused code ?
import firebase from "firebase/app";
import "firebase/auth";
The library is used via another package react-redux-firebase, which weights 13.81kb gzipped, but this is unrelated to this issue.
Hey @Fandekasp, appreciate the issue! Unfortunately given the structure of the SDK now, you have to pull in the whole package if you want to use anything from auth. It applies to all components, not just auth. We recognize this issue and are actively looking at how to modularize the library in the finer granularity.
I will keep the issue open and will report back once we have something concrete.
Hello, Is there any update on modularising the library ?
Hi @jsjain, the work is under way. We are very close to make an alpha release. Please follow the progress in https://github.com/firebase/firebase-js-sdk/issues/332
I didn't know about #332. ~Closing this issue as duplicate, will follow over there, thanks!~
Oops actually it's about reducing the size of libs overall while this one is about code-splitting, re-opened
The work on auth next (and the parallel work on all other libraries) involves code splitting, in fact, modularizing the API is the biggest change in this rewrite and the main source of size savings. e.g., It allows you to individually import auth methods (like signInWithPopup or onAuthStateChanged or getIdToken). Feel free to check out the PR linked at the end of the other issue (https://github.com/firebase/firebase-js-sdk/pull/3722) for the exact details for the auth code and stay up to date on its progress. It is really large so I don't know if it is worth it to you to dig through the code itself, but you can see when it's getting closer to being done.
Just to clarify, the request in the original post of that issue may be different than this one, but the solution is the same for both (and the auth section of it is in that PR).
We will track the issue in https://github.com/firebase/firebase-js-sdk/issues/332. Closing
Most helpful comment
The work on auth next (and the parallel work on all other libraries) involves code splitting, in fact, modularizing the API is the biggest change in this rewrite and the main source of size savings. e.g., It allows you to individually import auth methods (like
signInWithPopuporonAuthStateChangedorgetIdToken). Feel free to check out the PR linked at the end of the other issue (https://github.com/firebase/firebase-js-sdk/pull/3722) for the exact details for the auth code and stay up to date on its progress. It is really large so I don't know if it is worth it to you to dig through the code itself, but you can see when it's getting closer to being done.Just to clarify, the request in the original post of that issue may be different than this one, but the solution is the same for both (and the auth section of it is in that PR).