Skip to content

Prepare for Svelte 5 support #10318

Closed

Description

@Lms24

Important

Svelte 5 is not yet stable. We can't bump peer dependencies before it goes stable because we can't guarantee support yet. This issue serves as a collection of things we need to do for Svelte 5 support at this time. We can do some preparations beforehand but we won't guarantee support.

Problem Statement

Our @sentry/svelte SDK is not fully compatible with Svelte 5. This has two reasons

  • Svelte 5 requires type: "module" and exports in package.json
  • Svelte 5 no longer exports the current_component internal API (this was risky to use in the first place but yeah here we are...)

Solution Brainstorm

Tried a quick update today but the blocker here is that we also need to upgrade Jest or switch to vitest.

- [ ] #10311
- [ ] #10312
- [ ] https://github.com/getsentry/sentry-javascript/pull/10350
- [ ] https://github.com/getsentry/sentry-javascript/pull/11807

closes #10275
closes #10276

Activity

  1. self-assigned this
    on Jan 24, 2024
  2. added this to the 8.0.0 milestone on Jan 24, 2024
  3. Lms24 commented on Jan 24, 2024

    @Lms24
    MemberAuthor

    Added this to the v8 milestone. Might be worth to just expose the componentTrackingPreprocessor going forward and remove withSentryConfig again. I have the feeling this is not gonna play well with SvelteKit and I wanna stay away from such a general wrapper.

  4. dummdidumm commented on Feb 28, 2024

    @dummdidumm

    👋 Svelte maintainer here - if you have any questions regarding how to adapt the SDK to Svelte 5, let me know. Ideally Svelte 5 provides the public APIs you need to achieve what you want.

  5. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Feb 28, 2024
  6. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Feb 29, 2024
  7. Lms24 commented on Mar 1, 2024

    @Lms24
    MemberAuthor

    @dummdidumm thanks a lot! Are you planning on exposing a way of getting the component name in onMount callbacks? Previously we relied on the current_component internal API (I know, not smart) which was removed.

  8. dummdidumm commented on Mar 1, 2024

    @dummdidumm

    What do you need the component name for?

  9. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Mar 1, 2024
  10. Lms24 commented on Mar 1, 2024

    @Lms24
    MemberAuthor

    For a component mount and update time tracking utility we export from our Svelte SDK. We have some automatism around this (which we'll also rework in our next SDK major version) but this utility used to automatically obtain the component name without users having to specify it in Svelte 3 and 4.

    If this is no longer possible in Svelte 5, that's fine, I was just wondering because I'll soon start reworking this feature for Svelte 5 support.

  11. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Mar 1, 2024
  12. dummdidumm commented on Mar 2, 2024

    @dummdidumm

    Out of curiosity: how does this work for other frameworks? E.g. how do you obtain that name from React? Do they provide it? Or is there just no way and devs have to do something else there?

  13. moved this to Waiting for: Product Owner in GitHub Issues with 👀 2on Mar 2, 2024
  14. lforst commented on Mar 4, 2024

    @lforst
    Contributor

    @dummdidumm Other frameworks often don't have this API at all and people have to add it manually. React has an API for this but it needs build-time config. We built a feature in our bundler plugins to annotate components: getsentry/sentry-javascript-bundler-plugins#468

  15. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 2on Mar 4, 2024
  16. Lms24 commented on Apr 26, 2024

    @Lms24
    MemberAuthor

    I just merged #11807 which auto-closed this issue. We'll make a new beta release for v8 of our SDK on Monday which will ship with support for Svelte 5 (compatible with the latest Svelte 5 preview)!

  17. happycollision commented on May 13, 2024

    @happycollision

    I am testing out Svelte 5 and discovered this error message:

    Uncaught (in promise) Error: Your application, or one of its dependencies, imported from 'svelte/internal', which was a private module used by Svelte 4 components that no longer exists in Svelte 5. It is not intended to be public API. If you're a library author and you used 'svelte/internal' deliberately, please raise an issue on https://github.com/sveltejs/svelte/issues detailing your use case.

    The only package I see importing from svelte/internal is this one. Here is what I think is the relevant line of code:

    alias: [{ find: /^svelte$/, replacement: 'svelte/internal' }],

    @Lms24, would you like a separate issue opened for this, or do you want to do something else?

  18. Lms24 commented on May 13, 2024

    @Lms24
    MemberAuthor

    @happycollision did you try out Svelte 5 with version 8.0.0 RC or beta of the @sentry/svelte SDK? The vite config you linked shouldn't even end up in the SDK package. It's just for local development/testing. Apart from that we don't import from svelte/internal at all so my guess is you're using version 7 (where we did still import from svelte/internal).

    If you don't want to upgrade to a preview build, you're in luck: We're releasing 8.0.0 stable today :)

  19. happycollision commented on May 13, 2024

    @happycollision

    Hah. I guess that’s the deal, then. All I did was check that I was on latest, not beta.

  20. Lms24 commented on May 13, 2024

    @Lms24
    MemberAuthor

    Yup, we just released 8.0.0 - would love to hear if things work for you when you get a chance to upgrade :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions