-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
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 package are you using?
@sentry/svelte
SDK Version
7.15.0
Framework Version
Svelte 3
Link to Sentry event
No response
Steps to Reproduce
- Create Svelte Test App w/ a few components; some of them with
<script>tags, some without
Expected Result
The SDK should record spans for all components that should be tracked, regardless of if they have a <script> tag or not.
Actual Result
The SDK only records spans for components with one (or multiple) <script> tag(s) (afaict, we handle the multiple script tags case fine).
My suspicion is that components w/o <script> are not sent through the script preprocessor hook we use. If that is the case, we should consider switching to another hook or (if impossible/infeasible) update docs to inform people that they need to include a script tag.
To Do:
After discussing this internally, we decided to make some (backwards-compatible) changes to how we handle sentry-specific svelte.config.js entries. We'll go with a more general, withSentryConfig approach that allows us to have more freedom with adding future Svelte preprocessors or other compile-time specific sentry items.
By taking this approach, we can also fix this specific bug in a more elegant and much safer way.
- Create
withSentryConfigfunction to wrap around thesvelte.config.jsoption object (with feature parity to our current component tracking preprocessor) (feat(svelte): AddwithSentryConfigfunction to wrap User Svelte Configuration #5936)- Deprecate
trackComponentPreprocessorpackage export from the Svelte SDK
- Deprecate
- Adjust
componentTrackingPreprocessorto detect no-script components (fix(svelte): Track components without <script> tags #5957) - Update docs to point people to the new wrapper rather than inserting our preprocessor themselves (ref(svelte): Update component tracking docs with new
withSentryConfigapproach sentry-docs#5649)