sentry-javascript: error no matching export current_component - svelte 5 and sveltekit ^2.0
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
SDK Version
latest
Framework Version
svelte 5, sveltekit 2
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
svelte version ^5 and sveltekit ^2 install by guide, run dev.
Expected Result
no error message
Actual Result
error message - `No matching export in ‘svelte’ for import ‘current_component’
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Reactions: 2
- Comments: 30 (24 by maintainers)
Commits related to this issue
- Fix Sentry / Sveltekit+Svelte incompatibility Disabling performance monitoring for now, see https://github.com/getsentry/sentry-javascript/issues/10275 — committed to bradleyayers/haohao.how by bradleyayers 5 months ago
- Fix Sentry / Sveltekit+Svelte incompatibility Disabling performance monitoring for now, see https://github.com/getsentry/sentry-javascript/issues/10275 — committed to bradleyayers/haohao.how by bradleyayers 5 months ago
@JonathonRP The SDK does not yet support svelte 5. Progress is tracked here https://github.com/getsentry/sentry-javascript/issues/10318.
I investigated this a bit today but there’s an important piece of information missing: Svelte 5 is not yet supported by our SDK. This is on purpose because we can’t guarantee support for a framework version that’s not stable yet. However, if you don’t use
@sentry/sveltebut@sentry/sveltekit, chances are you might be missing this information because installing won’t necessarily show thepeerDependencyconflict:@sentry/svelteonly allows Svelte 3 and 4 as peer dependencies.Ideally, we find a way to unblock Svelte 5 users without changing too much but I tried doing so in #10311 and #10312 but turns out, changing the package.json properties will make our tests unusable because our jest version is too old 🥲
So this needs more work and I’m currently super busy with ~10 other tasks. I’ll write this up in a proper issue for now but can’t give you an ETA. Again, we do not support Svelte 5 until it becomes stable. So all the work I’m doing here would be merely preparation for this for you to use at your own risk.
Hey everyone, 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)!
Thanks for your patience and special shout out to @JonathonRP for setting the ground stone by porting our Svelte SDK tests from Jest to Vitest (#10350)!
All the items tracked in https://github.com/getsentry/sentry-javascript/issues/10318 need to be done for Svelte 5 support as far as we can tell right now. Feel free to give upgrading to vitest a try if you want. Happy to review the PR. We’re already using Vitest in our Astro and SvelteKit packages, so ideally, we use it similarly here.
I think though, considering removing the
current_componentimport is a “soft-breaking” change we’ll just merge everything in with v8. This will happen soon.I agree and we’ll remove it. PR is already up but as I said it requires more stuff. If you just remove the import, you’ll get another error in Svelte 5. As I said multiple times by now I can’t tackle this at right now but it’s on our list and tracked in #10318.
To confirm, did you revert back to SvelteKit 1.x? SvelteKit 2.x with Svelte 4 should work with Sentry. Only Svelte 5 is not supported.
hmm you seem to be getting the same error like me if you open your browser console. Looks like excluding the SDK from the optimizations causes this error:
Which is weird because we only use
magic-stringon the server side. I wonder how it ends up in the client bundle.this gets rid of the error, but for me sveltekit app is still not interactive which is my blocker and reason I cared about error, my app https://stackblitz.com/edit/sveltejs-kit-template-default-2lc4he?file=vite.config.js