-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(browser): Add lazyLoadIntegration
utility
#11339
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
Conversation
size-limit report 📦
|
return existing; | ||
} | ||
|
||
const url = `https://browser.sentry-cdn.com/${SDK_VERSION}/${bundle}.min.js`; |
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.
Can we make this domain configurable (now or future). It would also help with local dev to point to localhost for example.
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.
I added a cdnBaseUrl
config option for the client!
For ESM builds, should we expose a utility that uses If someone uses bundlers it should code split automatically. I fear this will be less effective in certain scenarios because adblockers will block |
6aa9ec2
to
dee0033
Compare
Hmm not sure, wouldn't it be better for them to just await import the integration themselves then? If you have a bundler there is no need really to use this if you don't want to...? |
aac25b7
to
2efd866
Compare
lazyLoadIntegration
utilitylazyLoadIntegration
utility
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.
Lets merge this in so we can start testing/running it end to end! Overall it's looking ready to me.
The LazyLoadableIntegrations
list is something to maintain going forward, but since the integration and bundle names are different seems like an inherent the cost of doing this kind of thing.
This can be used to lazy load a pluggable integration.
f2eb5e4
to
12eecd7
Compare
This can be used to lazy load a pluggable integration. Usage: ```js async function getOrLazyLoadFeedback() { const existing = Sentry.getFeedback(); // check if it has already been installed if (existing) { return existing; } try { const feedbackIntegration = await Sentry.lazyLoadIntegration('feedbackIntegration'); client.addIntegration(feedbackIntegration()); } catch(error) { // this can error, we need to handle this! } } ``` Closes getsentry#10905
This can be used to lazy load a pluggable integration.
Usage:
Closes #10905