firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

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

Open GaurangTandon opened this issue 1 year ago • 3 comments

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.

GaurangTandon avatar Apr 16 '24 05:04 GaurangTandon

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 avatar Apr 16 '24 19:04 dconeybe

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 avatar Apr 16 '24 20:04 dconeybe

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.

dconeybe avatar Apr 18 '24 15:04 dconeybe