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
feat(sveltekit): Update @sentry/vite-plugin to 2.x and adjust options API (#10813)
This PR updates `@sentry/vite-plugin` used in the SvelteKit SDK from
version 0.6.x to the latest 2.x version. In line with this change, we
now also decoupled the public API of the vite plugin from the SvelteKit
SDK public API, meaning we can bump to a higher plugin major version
while we stay in the same SDK major version.
Concrete changes:
- We now use DebugId-based sourcemap upload 🎉
- Due to architecture changes in `@sentry/vite-plugin`, our
`sentrySvelteKit` plugin factory function returns 6 (5x sourcemap, 1x
auto instrumentation) plugins instead of previously two. This is because
the Vite plugin now consists of several individual plugins.
- We still have to modify source maps a bit before uploading them and
all of this should still happen as late as possible. So we still create
a customized version of the uploading plugin and return that instead of
the original one.
- Also added direct usage of `MagicString` to inject global values
needed during runtime. Previously, I just handed my modified code to the
original plugin's `transform` hook which might have even messed up
source maps.
- The new API is a subset of all Sentry Vite plugin options.
- I'm happy to add more options before merging this PR. I just don't
think we need all of them right from the start. As an alternative, we
could allow users to pass in arbitrary options and we type them as
`unknown` or something along these lines 🤔
Example usage (showing all available options; all are optional)
```js
sentrySvelteKit({
autoUploadSourceMaps: true,
sourceMapsUploadOptions: {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
release: {
name: '1.0.1',
inject: true
},
sourcemaps: {
assets: ['./build/*/**/*'],
ignore: ['**/build/client/**/*'],
filesToDeleteAfterUpload: ['./build/**/*.map']
}
},
autoInstrument: true,
debug: true
}),
```
closes#9835closes#8283
---------
Co-authored-by: Francesco Novy <[email protected]>
* If this flag is `true`, the Sentry plugins will automatically upload source maps to Sentry.
@@ -18,7 +20,101 @@ type SourceMapsUploadOptions = {
18
20
* Options for the Sentry Vite plugin to customize and override the release creation and source maps upload process.
19
21
* See [Sentry Vite Plugin Options](https://github.com/getsentry/sentry-javascript-bundler-plugins/tree/main/packages/vite-plugin#configuration) for a detailed description.
0 commit comments