-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(feedback): Create async bundles and code to resolve helper integrations #11621
Changes from 9 commits
55500be
5c5130a
75d246a
7ee8631
238cb5c
08297f1
d29f87a
d4e42dc
f59555f
6e25a73
6200b01
c5daa22
b8c60ec
0fbf664
4997f25
780a936
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { | ||
buildFeedbackIntegration, | ||
feedbackModalIntegration, | ||
feedbackScreenshotIntegration, | ||
} from '@sentry-internal/feedback'; | ||
import { lazyLoadIntegration } from './utils/lazyLoadIntegration'; | ||
|
||
// The full feedback widget, with everything pre-loaded | ||
export const feedbackIntegration = buildFeedbackIntegration({ | ||
lazyLoadIntegration, | ||
getModalIntegration: () => feedbackModalIntegration, | ||
getScreenshotIntegration: () => feedbackScreenshotIntegration, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { buildFeedbackIntegration } from '@sentry-internal/feedback'; | ||
import { lazyLoadIntegration } from './utils/lazyLoadIntegration'; | ||
|
||
// This is for users who want to have a lazy-loaded feedback widget | ||
export const feedbackAsyncIntegration = buildFeedbackIntegration({ | ||
lazyLoadIntegration, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This whole |
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,7 @@ import { browserTracingIntegrationShim, replayIntegrationShim } from '@sentry-in | |
|
||
export * from './index.bundle.base'; | ||
|
||
export { | ||
feedbackIntegration, | ||
feedbackModalIntegration, | ||
feedbackScreenshotIntegration, | ||
getFeedback, | ||
} from '@sentry-internal/feedback'; | ||
export { feedbackIntegration } from './feedback'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that we're using This is something we can talk about and change outside this PR |
||
export { getFeedback } from '@sentry-internal/feedback'; | ||
|
||
export { browserTracingIntegrationShim as browserTracingIntegration, replayIntegrationShim as replayIntegration }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { getClient } from '@sentry/core'; | ||
import type { feedbackIntegration } from './integration'; | ||
import type { buildFeedbackIntegration } from './integration'; | ||
|
||
type FeedbackIntegration = ReturnType<typeof buildFeedbackIntegration>; | ||
|
||
/** | ||
* This is a small utility to get a type-safe instance of the Feedback integration. | ||
*/ | ||
export function getFeedback(): ReturnType<typeof feedbackIntegration> | undefined { | ||
export function getFeedback(): ReturnType<FeedbackIntegration> | undefined { | ||
const client = getClient(); | ||
return client && client.getIntegrationByName<ReturnType<typeof feedbackIntegration>>('Feedback'); | ||
return client && client.getIntegrationByName('Feedback'); | ||
} |
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.
The bundler seemed like it wasn't tree-shaking properly when this file was combined with
src/feedback.ts
. Splitting them apart resulted in the bundle-sizes I expected