fix(v8/svelte): Guard component tracking beforeUpdate
call
#15262
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a guard the Svelte SDK's component update tracking feature to catch an error thrown by Svelte 5 in Runes mode. In Runes mode, components must not call the old
beforeUpdate
orafterUpdate
lifecycle hooks. Usually, when users do this in their code, the Svelte compiler would throw a build error. However, since ourwithSentryConfig
wrapper adds a preprocessor that sneaks such a function call in, the compiler doesn't notice this (at least not in the webpack loader as reported in ##15259.This PR also cleans up the preprocessor adding logic which was overcomplicated and a leftover from when we added more than one preprocessor to users' svelte configs. In general, I cleaned up some unnecessary stuff and terminology.
I'll open a follow-up PR for v9 where I'll disable update tracking by default (see #15259 (comment))
closes #15259