Title: [Nuxt 5] Replace the Vue integration’s reliance on `app.mixin()` · Issue #23375 · getsentry/sentry-javascript · GitHub
Open Graph Title: [Nuxt 5] Replace the Vue integration’s reliance on `app.mixin()` · Issue #23375 · getsentry/sentry-javascript
X Title: [Nuxt 5] Replace the Vue integration’s reliance on `app.mixin()` · Issue #23375 · getsentry/sentry-javascript
Description: Nuxt 5 disables Vue’s Options API by defaultRefernce: nuxt/nuxt#35791 For the time being, it can be enabled in Nuxt with: export default defineNuxtConfig({ vue: { optionsApi: true } }) What app.mixin() captures today vueInit() in package...
Open Graph Description: Nuxt 5 disables Vue’s Options API by defaultRefernce: nuxt/nuxt#35791 For the time being, it can be enabled in Nuxt with: export default defineNuxtConfig({ vue: { optionsApi: true } }) What app.mix...
X Description: Nuxt 5 disables Vue’s Options API by defaultRefernce: nuxt/nuxt#35791 For the time being, it can be enabled in Nuxt with: export default defineNuxtConfig({ vue: { optionsApi: true } }) What app.mix...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/23375
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Nuxt 5] Replace the Vue integration’s reliance on `app.mixin()`","articleBody":"Nuxt 5 disables Vue’s Options API by default\u003cbr>Refernce: [https://github.com/nuxt/nuxt/pull/35791](\u003chttps://github.com/nuxt/nuxt/pull/35791>)\n\nFor the time being, it can be enabled in Nuxt with:\n\n```ts\nexport default defineNuxtConfig({\n vue: {\n optionsApi: true\n }\n})\n```\n---\n\n### What `app.mixin()` captures today\n\n`vueInit()` in `packages/vue/src/integration.ts` registers one mixin when tracing is on. That mixin produces every Vue UI span we emit:\n\n| Span | Op | Operation | Mixin hooks (start / end) | On by default |\n|---|---|---|---|---|\n| `Application Render` | `ui.render` | any | the root's first hook starts it, a `timeout` debounce (2000 ms) ends it | yes |\n| `Vue \u003cRoot>` | `ui.mount` | `mount` | `beforeMount` / `mounted` | yes |\n| `Vue \u003cComponentName>` | `ui.mount` | `mount` | `beforeMount` / `mounted` | no (`trackComponents`) |\n| `Vue \u003cComponentName>` | `ui.mount` | `activate` | `activated` / `deactivated` | no (`trackComponents`) |\n| `Vue \u003cComponentName>` | `ui.mount` | `create` | `beforeCreate` / `created` | no (`trackComponents` + `hooks: ['create']`) |\n| `Vue \u003cComponentName>` | `ui.update` | `update` | `beforeUpdate` / `updated` | no (`trackComponents` + `hooks: ['update']`) |\n| `Vue \u003cComponentName>` | `ui.unmount` | `unmount` (Vue 3) | `beforeUnmount` / `unmounted` | no (`trackComponents` + `hooks: ['unmount']`) |\n| `Vue \u003cComponentName>` | `ui.unmount` | `destroy` (Vue 2) | `beforeDestroy` / `destroyed` | no (`trackComponents` + `hooks: ['destroy']`) |\n\n**Not affected**: Pageload and navigation transactions come from `browserTracingIntegration` and the router. Error capture uses `app.config.errorHandler`, which Vue does not gate. Pinia and TanStack Router never touch mixins.\n\n### The alternative: register Composition API hooks in `setup`\n\nComposition API lifecycle hooks are not gated by `__VUE_OPTIONS_API__`. They write to `instance.m`, `instance.u`, and so on, and the renderer invokes those arrays unconditionally. The question is only how to reach every component's `setup`.\n\nTwo mechanisms, and the split runs between the root component and everything else.\n\n**Runtime, for the root.** `createApp` stores the root component as `app._component`, a plain writable property, and shallow-copies it first, so mutating `app._component.setup` in `vueInit()` does not touch the user's module. Function root components are not copied, so replace the property instead of mutating it. This covers both default-on spans with no plugin and no new install step.\n\n**Build time, for `trackComponents`.** A Vite, Rollup, or webpack plugin adds a `setup` to each `.vue` module's default export that registers the hooks and then calls the original `setup`. Wrap by adding to the existing options object rather than returning a new component, so `name` and `__file` survive.\n\n| Operation | Composition API hook | Runtime root wrap | Build-time plugin |\n|---|---|---|---|\n| `mount` (default on) | `onBeforeMount` / `onMounted` | `Application Render` and `Vue \u003cRoot>`, identical to the mixin | every `.vue` the plugin transforms |\n| `activate` (default on) | `onActivated` / `onDeactivated` | never fires, the root is not inside `\u003cKeepAlive>` | every `.vue` the plugin transforms |\n| `update` (opt-in) | `onBeforeUpdate` / `onUpdated` | root re-renders only | every `.vue` the plugin transforms |\n| `unmount` (opt-in) | `onBeforeUnmount` / `onUnmounted` | `app.unmount()` only | every `.vue` the plugin transforms |\n| `create` (opt-in) | none, `setup` is the create phase | approximate, brackets the original `setup` | approximate, same |\n\n\nComponent names stay correct. `compiler-sfc` emits `__name` in production builds, and `formatComponentName` already reads it.\n\nWhat it misses: render function and (non SFC) JSX components, runtime compiled templates, CDN builds, and pre-compiled components in `node_modules`, including Nuxt's own `\u003cNuxtPage>` and `\u003cNuxtLayout>`, unless the plugin also transforms `node_modules`.\n\nNuxt can get the plugin through the existing `addVitePlugin` call in `packages/nuxt/src/module.ts`. Plain `@sentry/vue` users need a new install step.\n\n### Vue 2 keeps the mixin\n\nWe cannot wrap `setup` at runtime in Vue 2, and Vue 2.7 does not change that.\n\nThe runtime wrap needs a handle on the root component's options object before Vue instantiates it. In Vue 3, `createApp(App)` gives us exactly that as `app._component`. In Vue 2 the integration receives the `Vue` constructor, the user calls `new Vue({...})` afterwards, and that options object never reaches us. Vue 2.7 backported the Composition API but explicitly did not port `createApp`, and 2.7 is the last Vue 2 minor.\n\n### Warning users on missing mixins\n\n`app.mixin()` is a silent no-op when `__VUE_OPTIONS_API__` is `false`, and Vue only warns in dev.\n\nWe can detect if mixins are disabled and we warn the users: https://github.com/getsentry/sentry-javascript/pull/23568\n\n\n","author":{"url":"https://github.com/s1gr1d","@type":"Person","name":"s1gr1d"},"datePublished":"2026-08-12T15:31:44Z","url":"https://github.com/getsentry/sentry-javascript/issues/23375"}
| 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:4cf5638c-3c07-f072-035a-d324d004f9be |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7E0:247A88:1F9905:2B75D4:6B074866 |
| html-safe-nonce | 6256e3d569ef76d46976e3b318653480da1c3c33459ab5eaea463a08b45f8783 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0UwOjI0N0E4ODoxRjk5MDU6MkI3NUQ0OjZCMDc0ODY2IiwidmlzaXRvcl9pZCI6IjM0MDQ3MDc5Nzk5MTkzMTI5OTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2f8a6254acf520e47b73520a93c21ea6c9dbf780ca7b9ffa69be91caa4b0a7ee |
| hovercard-subject-tag | issue:5132573732 |
| 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/23375/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0cfbba188f8607c58d87e3ff29925c6688d357cc1aa7ce5408e2a9557b298a97/getsentry/sentry-javascript/issues/23375 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0cfbba188f8607c58d87e3ff29925c6688d357cc1aa7ce5408e2a9557b298a97/getsentry/sentry-javascript/issues/23375 |
| og:image:alt | Nuxt 5 disables Vue’s Options API by defaultRefernce: nuxt/nuxt#35791 For the time being, it can be enabled in Nuxt with: export default defineNuxtConfig({ vue: { optionsApi: true } }) What app.mix... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | s1gr1d |
| hostname | github.com |
| expected-hostname | github.com |
| None | 26f151990bcb5b67b87df8b3f96ed340f849939d44e36f348402de5e39cca989 |
| 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 | cd00d8452bcb4e56a60ba7c0e61a697b46513fe9 |
| 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