Skip to content
Discussion options

You must be logged in to vote

Your instinct that automatic tree-shaking is doing most of the heavy lifting is correct, and it's worth separating what these two mechanisms are actually shaking.

The DefinePlugin variables (__SENTRY_DEBUG__, __SENTRY_TRACING__, etc.) don't remove anything by themselves, they turn internal if (__SENTRY_DEBUG__) { ... }-style branches inside Sentry's own source into dead code (if (false) { ... }). That dead branch only actually disappears from your bundle during minification, when Terser (or whatever minifier Webpack is using) runs its own dead-code elimination pass over the now-if (false) blocks. So checking the raw, unminified build output won't show a difference, these flags are invisib…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by scameron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants