Skip to content

ref(build): Use standard regex for minifying integration bundles #4651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2022

Conversation

lobsterkatie
Copy link
Member

This is very similar to #4592, which brought @sentry/wasm in line with other bundles in terms of which object properties it was willing to mangle (changing it from "nope, nuthin'" to "anything private, a.k.a., anything starting with exactly one underscore").

That PR was effectively a no-op, in that we made a change to a class of property which it turns out doesn't exist anywhere in the wasm package. In the case of this PR, though, that's not true: private properties do exist, and where they've been heretofore left alone by terser, they will now be mangled. This is a small bundle size win, but it is also technically a breaking change, at least for anyone using those properties directly.

That said, there's a reason we use a leading underscore to mark them as internal and tag them as private in TS - people aren't supposed to be using them. Further, out of the (hopefully very small if not non-existent) group of people mucking with our internals, this will only affect the subset who are both using the CDN and using one of these optional integrations, which the majority of our users do not. I therefore think it's a very small risk with not one but two small rewards, the bundle size reduction and further standardization of our rollup config.

@github-actions
Copy link
Contributor

size-limit report

Path Base Size (7525490) Current Size Change
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.77 KB 19.77 KB -0.01% 🔽
@sentry/browser - ES5 CDN Bundle (minified) 63.47 KB 63.47 KB 0%
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.44 KB 18.44 KB -0.02% 🔽
@sentry/browser - ES6 CDN Bundle (minified) 56.6 KB 56.6 KB 0%
@sentry/browser - Webpack (gzipped + minified) 22.2 KB 22.2 KB 0%
@sentry/browser - Webpack (minified) 76.36 KB 76.36 KB 0%
@sentry/react - Webpack (gzipped + minified) 22.23 KB 22.23 KB 0%
@sentry/nextjs Client - Webpack (gzipped + minified) 46.4 KB 46.4 KB 0%
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.23 KB 27.23 KB -0.01% 🔽

@lobsterkatie lobsterkatie requested a review from AbhiPrasad March 1, 2022 14:11
@lobsterkatie lobsterkatie merged commit 4df9f7f into master Mar 1, 2022
@lobsterkatie lobsterkatie deleted the kmclb-minify-private-integrations-properties branch March 1, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants