Skip to content

Commit 05a894e

Browse files
committed
perf(build): Reserve 'Sentry' name, do not compress toplevel
This prevents the terser mangle option from mangling the 'Sentry' name, and avoids a terser bug where our top-level 'var Sentry=' gets stripped. Less bundle size reduction, but it's of course important to still export the Sentry object.
1 parent d025e6b commit 05a894e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

dev-packages/rollup-utils/plugins/bundlePlugins.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function makeTerserPlugin() {
101101
// mangler won't touch user-facing things, but `sentryWrapped` is not user-facing, and would be mangled during
102102
// minification. (We need it in its original form to correctly detect our internal frames for stripping.) All three
103103
// are all listed here just for the clarity's sake, as they are all used in the frames manipulation process.
104-
reserved: ['captureException', 'captureMessage', 'sentryWrapped', 'sW'],
104+
reserved: ['Sentry', 'captureException', 'captureMessage', 'sentryWrapped', 'sW'],
105105
toplevel: true,
106106
properties: {
107107
// allow mangling of private field names...
@@ -145,7 +145,6 @@ export function makeTerserPlugin() {
145145
compress: {
146146
passes: 5,
147147
ecma: 2020,
148-
toplevel: true,
149148
unsafe_comps: true,
150149
unsafe_math: true,
151150
pure_getters: true,

0 commit comments

Comments
 (0)