Skip to content

fix(sveltekit): Avoid creating the Sentry Vite plugin in dev mode #8065

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

Merged
merged 1 commit into from
May 8, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented May 8, 2023

To upload source maps in SvelteKit, we create a custom plugin building on top of the Sentry Vite plugin, which creates a Sentry hub to collect telemetry. The problem is that in the current version of the Sentry Vite plugin, the hub is set as the current hub (makeMain) as soon as the plugin is created, causing tags from the plugin to leak to the user's Sentry projects in errors and transactions.

This will be fixed in the new major of the vite plugin but we should nevertheless avoid this for now. Hence, this PR fixes this leakage by simply not creating the plugin when we're in dev mode.

@Lms24 Lms24 requested a review from lforst May 8, 2023 12:23
@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 21.01 KB (-0.01% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 65.62 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.55 KB (-0.01% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 58.08 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 21.16 KB (0%)
@sentry/browser - Webpack (minified) 69.03 KB (0%)
@sentry/react - Webpack (gzipped + minified) 21.18 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 49.09 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 28.64 KB (-0.01% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26.86 KB (0%)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 47.35 KB (+0.15% 🔺)
@sentry/replay - Webpack (gzipped + minified) 41.13 KB (+0.15% 🔺)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 66.3 KB (+0.12% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 59.18 KB (+0.13% 🔺)

@Lms24 Lms24 self-assigned this May 8, 2023
@Lms24 Lms24 merged commit 5cd11c2 into develop May 8, 2023
@Lms24 Lms24 deleted the lms/sveltekit-dont-create-vite-plugin-in-dev-mode branch May 8, 2023 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants