Skip to content

Commit

Permalink
feat: Add note to tree shaking docs (#8143)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Luca Forstner <[email protected]>
Co-authored-by: Liza Mock <[email protected]>
  • Loading branch information
3 people authored Oct 16, 2023
1 parent bc5b16f commit ff253fa
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ If you want to minimize the bundle size of the Sentry SDK, we recommend reading

## Tree Shaking Optional Code

The Sentry SDK ships with code that is not strictly required for it to collect your errors. This includes, for example, code to debug your Sentry configuration or code to enable performance monitoring. While debug code can be very useful in development environments, it's not typically necessary to include it in your production bundles where it takes up valuable space. The JavaScript SDK includes a special flags in its CommonJS and ESM distributions, which can be used to facilitate tree shaking (removal) of such code during the build process.
The Sentry SDK ships with code that is not strictly required for it to collect your errors. This includes code to debug your Sentry configuration or code to enable performance monitoring, for example. While debug code can be very useful in development environments, it's not typically necessary to include it in your production bundles where it takes up valuable space. The JavaScript SDK includes special flags in its CommonJS and ESM distributions, which can be used to facilitate tree shaking (removal) of this kind of code during the build process.

<Note>
Anything that you don't import and use will <i>automatically</i> be tree
shaken away when using any modern bundler like Webpack, Rollup, Vite, or
similar. This means that optional integrations like Replay, BrowserTracing,
BrowserProfiling, and any unused utility methods won't be included in your
bundle unless you import and use them yourself. The rest of this page relates
to ways to tree shake internal SDK code, which isn't strictly required unless
you use certain features.
</Note>

### List Of Flags

Expand Down

1 comment on commit ff253fa

@vercel
Copy link

@vercel vercel bot commented on ff253fa Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

docs.sentry.io
sentry-docs.sentry.dev
sentry-docs-git-master.sentry.dev

Please sign in to comment.