-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(svelte): Add Svelte 5 support #11807
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
Conversation
@@ -52,3 +52,5 @@ export declare function flush(timeout?: number | undefined): PromiseLike<boolean | |||
export declare const continueTrace: typeof clientSdk.continueTrace; | |||
|
|||
export declare const metrics: typeof clientSdk.metrics & typeof serverSdk.metrics; | |||
|
|||
export declare function trackComponent(options: clientSdk.TrackingOptions): ReturnType<typeof clientSdk.trackComponent>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isomorphic type definition. This function no-ops on the server, so we can safely take the client-side types here.
}, | ||
"dependencies": { | ||
"@sentry/sveltekit": "latest || *", | ||
"@spotlightjs/spotlight": "2.0.0-alpha.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to clarify, to we want to leave this in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think it doesn't hurt and it helped with local inspection of envelope payloads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet!
In #11807 I added a SvelteKit+Svelte 5 E2E test. Let's also add a small Svelte 5 standalone/SPA app ensure we cover such apps as well.
This PR updates our Svelte and SvelteKit SDKs to support Svelte 5 (tested with latest Svelte 5 preview version).
Concrete changes and adjustments:
current_component
import from Svelte SDKtrackComponent
function, due to the export no longer being available in Svelte 5trackComponent
utility can no longer auto-obtain the component name. Instead, a component name needs to be provided when calling the function or it falls back to a default const name.trackComponent
utility to the Server-side of the SvelteKit SDK. Component tracking doesn't make much sense in SSR but only in client-side hydration and subsequent navigations. With this change, users can now manually calltrackComponent
within their pages/components.sentrySvelteKit
vite plugin. This is much better DX than making thewithSentryConfig
wrapper work with SvelteKit apps. We can do this at any point in time, I opened Add SvelteKit component tracking auto instrumentation #11808 to track it.svelte@5.x
whenever it's released. I don't think we should add the preview versions here but happy to change/remove for now if reviewers prefer.closes #10275
closes #10318