ref(utils): Simplify isDebugBuild
logging guard
#4696
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This simplifies the
isDebugBuild
check used to strip logging from minified bundles in two ways:It makes the return value independent of the value of
__SENTRY_BROWSER_BUNDLE__
, since we want to be able to have debug and non-debug browser bundles.It switches the variable on which it's based from one preventing debug logging which defaults to being unset to one enabling debug logging which defaults to being true. The effect is the same, but eliminating the double negative makes the intention clearer.
Note: This increases the bundle size because it turns off the fact that we've been unintentionally already stripping some logging from our bundles. (The old flag,
__SENTRY_NO_DEBUG__
, is set tofalse
in our rollup config, but until this changeisDebugBuild()
has only been checking for a value (any value), not a truthy value, so setting it tofalse
has had the same effect as setting it totrue
.) The increase is only temporary, though, as this change is really just prework for an improved debug/no-debug bundle generation system.