You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Move bundler flags to specifically named files to increase bundler plugin perf. #17048
In the bundler plugins we use a range of feature flags that we replace at bundle time so that certain large features can be stripped during minification and don't end up in users bundles if they're not using them:
To replace these we currently need to find and replace in every file that runs through the bundler. This can potentially be tens of thousands of files.
__SENTRY_DEBUG__ almost always ends up in a file called debug-build.js and we can use this knowledge to only try and find and replace in those specific files.
Rather than have these globals everywhere, we should move these to consts in files with a specific filename so that we can be more selective in the bundler plugins. This could impact bundler performance significantly.
This sounds like a good idea to me! We can probably do this selectively for the respective flags to reduce the perf impact over time. Feel free to pick this up whenever you have a minute. (just going over some issues and came across this one)
Actually, rather than move these replacements to specific files we should:
Use preserveModules: false
This way there is only one file per Sentry npm module. Bringing less files to the bundler table will result in faster builds for all.
In the bundler plugins, only do our replacements in files with */@sentry/* in the path
We can also use rollup/rolldown/vite hook filters which means only a handful of Sentry files will be targeted for replacements
This is better than the "specifically named files" option because we can do the above 2 steps individually without impacting backwards compatibility
Activity
linear commentedon Jul 16, 2025
JS-740 Move bundler flags to specifically named files to increase bundler plugin perf.
Lms24 commentedon Sep 17, 2025
This sounds like a good idea to me! We can probably do this selectively for the respective flags to reduce the perf impact over time. Feel free to pick this up whenever you have a minute.
(just going over some issues and came across this one)
timfish commentedon Oct 31, 2025
Actually, rather than move these replacements to specific files we should:
preserveModules: falseThis way there is only one file per Sentry npm module. Bringing less files to the bundler table will result in faster builds for all.
*/@sentry/*in the pathWe can also use rollup/rolldown/vite hook filters which means only a handful of Sentry files will be targeted for replacements
This is better than the "specifically named files" option because we can do the above 2 steps individually without impacting backwards compatibility