-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(browser): Separate dev/prod browser builds #18078
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
base: develop
Are you sure you want to change the base?
Conversation
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really promising, thanks Tim!
(I realize this is still in draft so feel free to ignore this review if you're still planning on making changes)
8d0f261 to
92bc9f6
Compare
size-limit report 📦
|
41be108 to
eb515c4
Compare
|
Needs some tests to confirm Spotlight actually works in dev mode... |
| options.defaultIntegrations == null ? getDefaultIntegrations(options) : options.defaultIntegrations; | ||
|
|
||
| /* rollup-include-development-only */ | ||
| if (options.spotlight) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard would it be to fill this value from the env variables? I'm okay with trying all variants like PUBLIC_SENTRY_SPOTLIGHT or VITE_SENTRY_SPOTLIGHT etc.
Happy to do this in a follow up too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah probably best in a follow up PR. If we can keep it between the magic comments it'll all get striped out!
| import { globalHandlersIntegration } from './integrations/globalhandlers'; | ||
| import { httpContextIntegration } from './integrations/httpcontext'; | ||
| import { linkedErrorsIntegration } from './integrations/linkederrors'; | ||
| import { spotlightBrowserIntegration } from './integrations/spotlight'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Development-only import leaked into production bundle
The spotlightBrowserIntegration import is not wrapped in the development-only magic comments, but its usage is. This means the spotlight integration module will be bundled into production builds even though it's only used in development mode (lines 97-105). The import should be wrapped in /* rollup-include-development-only */ and /* rollup-include-development-only-end */ comments to ensure it's tree-shaken from production builds, reducing bundle size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any sort of bundling will remove this, it's just an unused import...
This PR:
The development build has this code:
But production builds have this stripped out: