getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.87k stars 1.55k forks source link

@sentry/react & @sentry/tracing 6.19.6 -> 6.19.7 adding 10kB to bundle #5003

Closed ericgrigorian closed 1 year ago

ericgrigorian commented 2 years ago

Problem Statement

I just updated from 6.19.6 to 6.19.7 and sentry added over 10kB to my entrypoint!! That is incredibly big difference in size. So unfortunately for the sake of performance I downgraded back to 6.19.6.

Solution Brainstorm

Not sure what you can do about it and I know v7 is supposed to help with it but please be a bit more courteous, I work on some apps where 10kB would increase the total size of the app by 10%-15%.

Lms24 commented 2 years ago

Hey @ericgrigorian thanks for bringing this up. So to confirm, you're using the NPM packages @sentry/tracing and @sentry/react? And did you upgrade both packages to 6.19.7? Do you know which of the two packages caused the increase for you?

I made a quick search w.r.t what might be causing this. The only thing that changed for reacht was #4966 which is a small change was #4966 which is a small change. For Tracing, we changed stuff regarding side-effects (#4955) which could be the culprit here.

ericgrigorian commented 2 years ago

Hey @Lms24, that's correct I'm using both @sentry/tracing and @sentry/react and upgraded both to keep the versions in parity. I'm not sure which one caused the increase but let upgrade them individually and get back to you later today.

Looking at the two commits you referenced, I think you're right that tracing may be the issue here.

Lms24 commented 2 years ago

Could you tell me how you're bundling your app? Are you using Rollup, Webpack or something else?

odusseys commented 2 years ago

Same issue here, using the same versions, and create-react-app 5 (so webpack) to build

Lms24 commented 2 years ago

We'll look into this but currently, our focus is to get v7 out (first beta will be out soon). If going back to 6.19.6 works for you, I suggest doing that for now (or giving our v7 alphas/betas a try). Meanwhile, if you happen to find a fix, PRs are always welcome and appreciated :) I just want to point out that Tracing has side effects which weren't listed correctly in package.json in the last patches before 6.19.7. So chances are that your 6.19.6 bundles were smaller than that before because something was tree shaken out by webpack that shouldn't have been removed. I checked the size of the respective packages and I couldn't find that increase in the packages themselves. Hence I think this might be related to what Webpack is doing at application compile time.

HazAT commented 1 year ago

We shipped v7 with treeshaking, should be resolved.