8000 fix(core): Stop mangling `_experiments` (#4807) · michax/sentry-javascript@adda306 · GitHub
[go: up one dir, main page]

Skip to content

Commit adda306

Browse files
authored
fix(core): Stop mangling _experiments (getsentry#4807)
We hide experimental options behind an `_experiments` flag. This is fine for folks using our npm packages, but for folks using CDN bundles it's a problem, because until now, we've been mangling the property name `_experiments`. (Normally, properties starting with a single underscore are private class methods or fields, the names of both of which it's fine to mangle. We therefore use that as our criterion when telling terser what it may and may not touch, and `_experiments` has been getting swept up by that regex.) This carves out an exception for `_experiments`, so that it is no longer mangled.
1 parent 292f30b commit adda306

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

rollup.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ function makeIsDebugBuildPlugin(includeDebugging) {
5757
});
5858
}
5959

60+
// `terser` options reference: https://github.com/terser/terser#api-reference
61+
// `rollup-plugin-terser` options reference: https://github.com/TrySound/rollup-plugin-terser#options
6062
export const terserPlugin = terser({
6163
mangle: {
6264
// captureExceptions and captureMessage are public API methods and they don't need to be listed here
@@ -66,6 +68,7 @@ export const terserPlugin = terser({
6668
reserved: ['captureException', 'captureMessage', 'sentryWrapped'],
6769
properties: {
6870
regex: /^_[^_]/,
71+
reserved: ['_experiments'],
6972
},
7073
},
7174
output: {

0 commit comments

Comments
 (0)
0