ember-graphql / ember-apollo-client

🚀 An ember-cli addon for Apollo Client and GraphQL
MIT License
279 stars 72 forks source link

Much bigger bundle size after upgrading @apollo/client #438

Closed tniezurawski closed 1 year ago

tniezurawski commented 1 year ago

We use the latest ember-apollo-client with embroider, Ember 4.11.0 and ember-auto-import@2.6.1 (pretty much the latest versions at the time of writting). After upgrading @apollo/client from 3.5.10 to 3.6.0 (one version up) our bundle size exploded.

According to Bundlephobia, the difference between these versions is minimal. Only 0.8KB gzipped:

image

But somehow our main bundle went up a lot. After investigation, I realized that something wrong is going on in ember-apollo-client. Before the upgrade, it was just a thin layer with a 6.14KB size (gzipped):

image

After the upgrade it's 97.45KB (gzipped):

image

I see it's packaging 63-65 modules extra:

image

I guess it's concatenating the whole @apollo/client instead of being just a thin layer 🤔 Maybe even 3 times! I see ember-apollo-client imports from @apollo/client/core but why such a difference between versions? (I don't see anything related in 3.6.0's changelog)

Does anyone have any pointers for me? Any idea I can try?

tniezurawski commented 1 year ago

Okay, now I understand. The issue can be closed. I was bundling two versions of @apollo/client:

image

After adding a resolution to package.json, the library is properly deduped and everything seems to be still working fine 👍

Sorry for the noise!