You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 necessary
adjust 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.
The content you are editing has changed. Please copy your edits and refresh the page.
Problem Statement
Currently, in SvelteKit, we instruct users to wrap
withSentryViteConfig
around their vite config object, similarly towithSentryConfig
in the NextJS SDK. There are a couple of concerns with this approach: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 directoriesWe 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
ref: #6692 #7669
The text was updated successfully, but these errors were encountered: