-
-
Couldn't load subscription status.
- Fork 1.7k
Description
Problem Statement
On my team we bundle everything that we're importing, and sentry has become a huge pain when it comes to bundle size reduction. We recently updated to a new version of the @sentry/browser package and have found a huge contribution (300kb) from the @sentry-internal/feedback package. We do not plan to use sentry for feedback collection, so we want to tell our bundler to ignore @sentry-internal/feedback but that breaks calls to init because for some reason, it tries to build feedback integration even though we didn't request it in the options!
This is the work around we have to do now:
const stubSentryFeedback: Plugin = {
name: 'stub-sentry-feedback',
setup(build) {
build.onLoad({ filter: /@sentry-internal\/feedback/ }, () => {
return {
contents: `
export function getFeedback() {};
export function sendFeedback() {};
export function feedbackScreenshotIntegration() {};
export function buildFeedbackIntegration() {};
export function feedbackModalIntegration() {};
`,
loader: 'js',
};
});
},
};
But it would very nice if it worked the same way that ignoring @sentry-internal/replay does, where just ignoring it and not using is enough to avoid bundling the code!
Solution Brainstorm
Per my comment, when we do not enable feedback through init args, it shoudn't try to call the embedded modules so that website bundlers could safely ignore those imports.
Metadata
Metadata
Assignees
Labels
Projects
Status