Skip to content

Commit 5724141

Browse files
committed
chore: added note on rolldown minification
1 parent f2b9734 commit 5724141

File tree

1 file changed

+50
-47
lines changed

1 file changed

+50
-47
lines changed

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

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -73,51 +73,54 @@ export function makeBrowserBuildPlugin(isBrowserBuild) {
7373
* @returns {import('rolldown').OutputOptions['minify']}
7474
*/
7575
export function makeMinifierOptions() {
76-
return {
77-
mangle: {
78-
// `captureException` and `captureMessage` are public API methods and they don't need to be listed here, as the
79-
// mangler won't touch user-facing things, but `sentryWrapped` is not user-facing, and would be mangled during
80-
// minification. (We need it in its original form to correctly detect our internal frames for stripping.) All three
81-
// are all listed here just for the clarity's sake, as they are all used in the frames manipulation process.
82-
reserved: ['captureException', 'captureMessage', 'sentryWrapped'],
83-
properties: {
84-
// allow mangling of private field names...
85-
regex: /^_[^_]/,
86-
reserved: [
87-
// ...except for `_experiments`, which we want to remain usable from the outside
88-
'_experiments',
89-
// We want to keep some replay fields unmangled to enable integration tests to access them
90-
'_replay',
91-
'_canvas',
92-
// We also can't mangle rrweb private fields when bundling rrweb in the replay CDN bundles
93-
'_cssText',
94-
// We want to keep the _integrations variable unmangled to send all installed integrations from replay
95-
'_integrations',
96-
// _meta is used to store metadata of replay network events
97-
'_meta',
98-
// We store SDK metadata in the options
99-
'_metadata',
100-
// Object we inject debug IDs into with bundler plugins
101-
'_sentryDebugIds',
102-
// These are used by instrument.ts in utils for identifying HTML elements & events
103-
'_sentryCaptured',
104-
'_sentryId',
105-
// Keeps the frozen DSC on a Sentry Span
106-
'_frozenDsc',
107-
// These are used to keep span & scope relationships
108-
'_sentryRootSpan',
109-
'_sentryChildSpans',
110-
'_sentrySpan',
111-
'_sentryScope',
112-
'_sentryIsolationScope',
113-
// require-in-the-middle calls `Module._resolveFilename`. We cannot mangle this (AWS lambda layer bundle).
114-
'_resolveFilename',
115-
// Set on e.g. the shim feedbackIntegration to be able to detect it
116-
'_isShim',
117-
// This is used in metadata integration
118-
'_sentryModuleMetadata',
119-
],
120-
},
121-
},
122-
};
76+
// FIXME: mangle properties options are not supported by rolldown yet, so we return true for now.
77+
// We should remove this once rolldown supports these options.
78+
// Keeping the original options for reference in case we want to add them back.
79+
// For now, rolldown won't mangle properties, so it should be safe.
80+
// https://github.com/oxc-project/oxc/issues/15375
81+
// `captureException` and `captureMessage` are public API methods and they don't need to be listed here, as the
82+
// mangler won't touch user-facing things, but `sentryWrapped` is not user-facing, and would be mangled during
83+
// minification. (We need it in its original form to correctly detect our internal frames for stripping.) All three
84+
// are all listed here just for the clarity's sake, as they are all used in the frames manipulation process.
85+
// reserved: ['captureException', 'captureMessage', 'sentryWrapped'],
86+
// properties: {
87+
// // allow mangling of private field names...
88+
// regex: /^_[^_]/,
89+
// reserved: [
90+
// // ...except for `_experiments`, which we want to remain usable from the outside
91+
// '_experiments',
92+
// // We want to keep some replay fields unmangled to enable integration tests to access them
93+
// '_replay',
94+
// '_canvas',
95+
// // We also can't mangle rrweb private fields when bundling rrweb in the replay CDN bundles
96+
// '_cssText',
97+
// // We want to keep the _integrations variable unmangled to send all installed integrations from replay
98+
// '_integrations',
99+
// // _meta is used to store metadata of replay network events
100+
// '_meta',
101+
// // We store SDK metadata in the options
102+
// '_metadata',
103+
// // Object we inject debug IDs into with bundler plugins
104+
// '_sentryDebugIds',
105+
// // These are used by instrument.ts in utils for identifying HTML elements & events
106+
// '_sentryCaptured',
107+
// '_sentryId',
108+
// // Keeps the frozen DSC on a Sentry Span
109+
// '_frozenDsc',
110+
// // These are used to keep span & scope relationships
111+
// '_sentryRootSpan',
112+
// '_sentryChildSpans',
113+
// '_sentrySpan',
114+
// '_sentryScope',
115+
// '_sentryIsolationScope',
116+
// // require-in-the-middle calls `Module._resolveFilename`. We cannot mangle this (AWS lambda layer bundle).
117+
// '_resolveFilename',
118+
// // Set on e.g. the shim feedbackIntegration to be able to detect it
119+
// '_isShim',
120+
// // This is used in metadata integration
121+
// '_sentryModuleMetadata',
122+
// ],
123+
// },
124+
125+
return true;
123126
}

0 commit comments

Comments
 (0)