Skip to content

feat(sveltekit): Add sentrySvelteKitPlugin #7788

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
Apr 7, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Apr 7, 2023

This PR adds the sentrySvelteKitPlugin vite plugin to the SvelteKit SDK which will replace the withSentryViteConfig wrapper. Currently, this plugin does exactly what the wrapper is doing, namely, adding the injectInitPlugin. In the future, this plugin will also add the source maps plugin.

Usage:

// vite.config.ts|js
export default defineConfig({
  plugins: [sentrySvelteKitPlugin(), sveltekit()],
  // rest of config
});

I'll remove withSentryViteConfig in a follow-up PR, to keep the removal atomic.

ref #7787

@Lms24 Lms24 requested review from a team, mydea and AbhiPrasad and removed request for a team April 7, 2023 13:01
@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.94 KB (+0.08% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 65.44 KB (+0.03% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.49 KB (+0.08% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 57.88 KB (+0.04% 🔺)
@sentry/browser - Webpack (gzipped + minified) 21.11 KB (+0.06% 🔺)
@sentry/browser - Webpack (minified) 68.87 KB (+0.03% 🔺)
@sentry/react - Webpack (gzipped + minified) 21.14 KB (+0.07% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.9 KB (+0.03% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 28.5 KB (+0.06% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26.73 KB (+0.06% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 44.89 KB (-0.07% 🔽)
@sentry/replay - Webpack (gzipped + minified) 38.85 KB (-0.06% 🔽)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 63.78 KB (-0.05% 🔽)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 56.82 KB (-0.05% 🔽)

* Vite Plugin for the Sentry SvelteKit SDK, taking care of:
*
* - Creating Sentry releases and uploading source maps to Sentry
* - Injecting Sentry.init calls if you use dedicated `sentry.(client|server).config.ts` files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we think about removing this injection behaviour all together then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was sort of debating if we should keep it as an alternative but I think the drawback is that we have to support both ways. Also the init location of hook vs. injected init calls differs slightly in the final bundles. Since IMO hooks are the better choice anyway, I'd say we remove it.

But I suggest we do it in a follow up PR, to make reverting easier if we have to, wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do it in a follow up PR!

@Lms24 Lms24 self-assigned this Apr 7, 2023
@Lms24 Lms24 merged commit d23214d into develop Apr 7, 2023
@Lms24 Lms24 deleted the lms/sveltekit-add-sentrySvelteKitPlugin branch April 7, 2023 13:30
Lms24 added a commit that referenced this pull request Apr 7, 2023
Remove the `withSentryViteConfig` wrapper in favour of `sentrySvelteKitPlugin` introduced in #7788.
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