Closed oneillsp96 closed 1 year ago
@oneillsp96 Thanks for writing in! The Replay integration should be tree-shaken from the bundle by default by all the major bundlers (webpack, rollup, vite, esbuild). It is entirely optional, and not automatically imported when you use Sentry.init
. In addition, it is not exposed as part of the main CDN bundle, but instead requires the use of a separate CDN bundle.
We analyze our bundle size for each PR we make, see the latest result here: https://github.com/getsentry/sentry-javascript/pull/6761#issuecomment-1380710647
Could you give us more details/a reproduction of your setup if you're finding there is a noticeable bundle size increase? Thanks!
Closing as per @AbhiPrasad's reply: The Replay code won't be pulled in unless you import/add the integration.
Feel free to reopen if this isn't the case for you.
ah, my bad, was looking at a dev build. Looks like it does get shaken correctly in a prod build (CRA)
@bruno-garcia @AbhiPrasad I'm left another comment here https://github.com/getsentry/sentry-javascript/issues/6886#issuecomment-1441078682 but using vite 4.1.4 and rollup treeshaking, replay is not getting removed.
As per https://github.com/getsentry/sentry-javascript/pull/6761#issuecomment-1380710647 it seems to only be testing with Webpack and not Rollup.
Just for reference, @AbhiPrasad found the problem and how to resolve it here https://github.com/getsentry/sentry-javascript/issues/6886#issuecomment-1441398001.
Problem Statement
I read your article about shrinking your massive bundle size, and then when I upgraded from 6.x -> 7.x found that bundle size actually increased.
Solution Brainstorm
I don't think the replay integration should be included in sentry/browser by default. If it must be, please provide better docs on how to remove it/ tree shake it (is removing it even possible like it is with other integrations such as Dedupe etc?)