firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.74k stars 868 forks source link

Upgrade from 9.10.0 to 10.11.0 leads to 46kB increase in bundle size #8171

Open GaurangTandon opened 1 month ago

GaurangTandon commented 1 month ago

Operating System

macOS

Browser Version

Chrome 123

Firebase SDK Version

10.11.0

Firebase SDK Product:

Auth, Firestore, Functions

Describe your project's tooling

React app with create-react-app default configuration.

Describe the problem

When upgrading from 9.10.0 to 10.11.0, I notice the bundle size is increased by 46606 bytes. This is a huge increase and it's unclear why it has happened, given that we are still using the same functions and interfaces as before.

I did run webpack-bundle-analyzer and couldn't find anything different in the bundle structure.

This is the new bundle:

This is the old bundle:

All components have increased in size proportionately. There's no one bundle that seems to jump out.

Steps and code to reproduce issue

You can create a create-react-app project with the relevant firebase products (auth/firestore/functions) and build it with 9.10.0 and 10.11.0 and notice the difference in bundle size.

dconeybe commented 1 month ago

Thanks for reporting this issue. I checked out Firestore specifically and noticed it grew by 32,022 bytes (11%) in my contrived scenario. I'll see if I can find any spikes or if it grew organically over time as new features were added.

dconeybe commented 1 month ago

It turns out that this growth is organic, due to new features and performance improvements. That's not to say that there isn't some room for improvement. I've logged b/335277615 internally to track an investigation into this for Firestore. I cannot make any promises on if and when we will get the bundle size reduced; however, it is on our radar.

dconeybe commented 1 month ago

FYI https://github.com/firebase/firebase-js-sdk/pull/8178 will reduce the bundle size by about 6.5 kB (for apps that just use the default "memory" persistence and don't use indexeddb persistence). This increase was accidentally introduced in v10.7.2.