Title: [@sentry/svelte] Component tracking with withSentryConfig + webpack breaks Svelte 5 runes mode · Issue #15259 · getsentry/sentry-javascript · GitHub
Open Graph Title: [@sentry/svelte] Component tracking with withSentryConfig + webpack breaks Svelte 5 runes mode · Issue #15259 · getsentry/sentry-javascript
X Title: [@sentry/svelte] Component tracking with withSentryConfig + webpack breaks Svelte 5 runes mode · Issue #15259 · getsentry/sentry-javascript
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/...
Open Graph 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 th...
X 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 th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/15259
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[@sentry/svelte] Component tracking with withSentryConfig + webpack breaks Svelte 5 runes mode","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/svelte\n\n### SDK Version\n\n8.52.1\n\n### Framework Version\n\nSvelte v5.19.6\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\nRepro: https://github.com/scottohara/svelte5-withsentryconfig-bug\n\nThe issue occurs when the following is true:\n1. You have a Svelte component that uses runes (e.g. `let now = $state(new Date().toString());`)\n2. The app is build using webpack + svelte-loader\n3. You wrap the options passed to svelte-loader with `withSentryConfig()` to enable component tracking, e.g.\n\n```js\nexport default {\n mode: \"production\",\n module: {\n rules: [\n {\n test: /\\.svelte$/u,\n loader: \"svelte-loader\",\n options: withSentryConfig({\n compilerOptions: {...}\n })\n }\n ]\n }\n}\n```\n\n### Steps to Reproduce\n\n### Setup\n\n```sh\ngit clone https://github.com/scottohara/svelte5-withsentryconfig-bug.git\ncd svelte5-withsentryconfig-bug\nnpm install\nwebpack\n```\n\n### Verify working\nAt this point, open the file `dist/index.html` in your browser. You should see a message like:\n> The time is `\u003cthe current date and time>`\n\nThis confirms that app builds & runs successfully _without_ component tracking.\n\n### Enable component tracking\n\n```sh\nWITH_SENTRY=1 webpack\n```\n\nThe `WITH_SENTRY=1` environment variable instructs the webpack config to wrap the svelte-loader options in `withSentryConfig()`.\nNow open (or refresh) the `dist/index.html` page in your browser. You should now see a blank page, and in the browser console the following error:\n\n> Uncaught Error: https://svelte.dev/e/lifecycle_legacy_only\n\nWhen caught, the error message is in fact:\n\n> `beforeUpdate(...)` cannot be used in runes mode\n\n### Expected Result\n\nWhen component tracking is enabled (in the example repo, by passing `WITH_SENTRY=1` to the webpack command; the app should not error and should display the same as when component tracking is disabled.\n\n### Actual Result\n\n### With component tracking disabled\nA successful render, and no console errors:\n\n\n\n### With component tracking enabled\nA failed render (blank page), and the Svelte legacy error:\n\n\n\n### Why does this happen?\nI believe that the root cause is the code in `@sentry/svelte` that does component tracking uses the `beforeUpdate(...)` lifecycle method.\nThis lifecycle method is [deprecated in Svelte 5](https://svelte.dev/docs/svelte/lifecycle-hooks#Deprecated:-beforeUpdate-afterUpdate).\n\nIt may be the case that `withSentryConfig()` was never designed to be used with webpack + svelte-loader (as it doesn't seem to have any issues when used in a Vite-based Svelte5 project).\n\nHowever prior to Svelte 5 and runes mode, using `withSentryConfig` in webpack + svelte-loader in this way did not throw any errors.\n\n","author":{"url":"https://github.com/scottohara","@type":"Person","name":"scottohara"},"datePublished":"2025-02-03T04:47:26Z","url":"https://github.com/getsentry/sentry-javascript/issues/15259"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:68096d61-3a45-b052-75ca-1b984f0002b0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD06:137FF:B88152:E98C37:6B036DFF |
| html-safe-nonce | c5df043d0cdd21a7d6b753b168140922bef5b33f2810ea3ec874b4ffe1ffce1d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDA2OjEzN0ZGOkI4ODE1MjpFOThDMzc6NkIwMzZERkYiLCJ2aXNpdG9yX2lkIjoiNzMwNDk4MzQ3NTIyNzE2MDA2MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e37bc259dc7232b34cd1dfe2e35a07eb5e7b01d3b5a9d66c1b87458eaadcb04a |
| hovercard-subject-tag | issue:2826395873 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/15259/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f8f50160cf46ed6f686b5069d619c654167f0c8b382b2e24c58e972a40dd9fc5/getsentry/sentry-javascript/issues/15259 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f8f50160cf46ed6f686b5069d619c654167f0c8b382b2e24c58e972a40dd9fc5/getsentry/sentry-javascript/issues/15259 |
| og:image:alt | 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 th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | scottohara |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width