Skip to content
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

[v8] Bump @sentry/vite-plugin in @sentry/sveltekit & stop exposing options directly #9835

Closed
Tracked by #9508
mydea opened this issue Dec 14, 2023 · 0 comments · Fixed by #10813
Closed
Tracked by #9508

[v8] Bump @sentry/vite-plugin in @sentry/sveltekit & stop exposing options directly #9835

mydea opened this issue Dec 14, 2023 · 0 comments · Fixed by #10813
Assignees
Labels
Package: sveltekit Issues related to the Sentry SvelteKit SDK
Milestone

Comments

@mydea
Copy link
Member

mydea commented Dec 14, 2023

We want to bump the vite-plugin version to latest in SvelteKit, and also stop passing plugin options through directly so we can in the future update this easier without a breaking change.

see #8283

@mydea mydea added this to the 8.0.0 milestone Dec 14, 2023
@mydea mydea added the Package: sveltekit Issues related to the Sentry SvelteKit SDK label Dec 14, 2023
@mydea mydea mentioned this issue Dec 14, 2023
@Lms24 Lms24 self-assigned this Feb 26, 2024
mydea added a commit that referenced this issue Feb 28, 2024
…ns 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 #9835 
closes #8283

---------

Co-authored-by: Francesco Novy <francesco.novy@sentry.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: sveltekit Issues related to the Sentry SvelteKit SDK
Projects
None yet
2 participants