Skip to content

Svelte Component Tracking doesn't pick up components without a <script> tag #5923

@Lms24

Description

@Lms24

Is there an existing issue for this?

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

  1. 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.

Metadata

Metadata

Assignees

Labels

Package: svelteIssues related to the Sentry Svelte SDK

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions