-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Package: sveltekitIssues related to the Sentry SvelteKit SDKIssues related to the Sentry SvelteKit SDKType: Improvement
Description
Problem Statement
Currently, in SvelteKit, we instruct users to wrap withSentryViteConfig
around their vite config object, similarly to withSentryConfig
in the NextJS SDK. There are a couple of concerns with this approach:
- Depending on other wrappers people might use, our current types for the wrapper would cause TS errors. This is fixable by using broad enough generics but should we (see other points)?
- We received feedback that such a generic wrapper around the entire config is a little opaque in what it actually does and why we don’t simply use a plugin instead. Fair enough then!
Solution Brainstorm
Vite's plugin system exposes the configure
hook which we can use to modify users' vite configs within a plugin.
So we'll build a "meta" SentrySvelteKitPlugin
which adjusts the user's vite config:
Inject the init injection plugin if necessaryadjust the allowed serve directories- This will be dropped as a feature in favour of using hooks.
- Inject the source maps plugin (=Sentry Vite Plugin w/ a couple of modifications)
- In the future, possibly inject other plugins for auto instrumentation
We believe this provides a more transparent API than wrapping the entire config. At the same time, we don't lose the freedom to introduce further modification of the config.
The SvelteKit build plugin itself also uses the configure
hook to merge user config w/ Kit-internal config.
Tasks
- [ ] https://github.com/getsentry/sentry-javascript/pull/7788
- [ ] #7789
- [ ] #7791
- [ ] #7792
Metadata
Metadata
Assignees
Labels
Package: sveltekitIssues related to the Sentry SvelteKit SDKIssues related to the Sentry SvelteKit SDKType: Improvement