Skip to content

Commit ff253fa

Browse files
mydeaLuca Forstnerlizokm
authored
feat: Add note to tree shaking docs (#8143)
--------- Co-authored-by: Luca Forstner <luca.forstner@sentry.io> Co-authored-by: Liza Mock <liza.mock@sentry.io>
1 parent bc5b16f commit ff253fa

File tree

1 file changed

+11
-1
lines changed
  • src/platforms/javascript/common/configuration/tree-shaking

1 file changed

+11
-1
lines changed

src/platforms/javascript/common/configuration/tree-shaking/index.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,17 @@ If you want to minimize the bundle size of the Sentry SDK, we recommend reading
1111

1212
## Tree Shaking Optional Code
1313

14-
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.
14+
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.
15+
16+
<Note>
17+
Anything that you don't import and use will <i>automatically</i> be tree
18+
shaken away when using any modern bundler like Webpack, Rollup, Vite, or
19+
similar. This means that optional integrations like Replay, BrowserTracing,
20+
BrowserProfiling, and any unused utility methods won't be included in your
21+
bundle unless you import and use them yourself. The rest of this page relates
22+
to ways to tree shake internal SDK code, which isn't strictly required unless
23+
you use certain features.
24+
</Note>
1525

1626
### List Of Flags
1727

0 commit comments

Comments
 (0)