Repository navigation
perf(nuxt): add vue.optionsApi and disable it for v5+ - #35791
Conversation
@nuxt/kit
@nuxt/nitro-server
nuxt
@nuxt/rspack-builder
@nuxt/schema
@nuxt/vite-builder
@nuxt/webpack-builder
commit: |
vue.optionsApi and disable it for v5+vue.optionsApi and disable it for v5+
Merging this PR will not alter performance
Comparing Footnotes
|
acd6c45 to
cfe8410
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/1.getting-started/18.upgrade.md`:
- Line 599: Update the compatibilityVersion: 5 documentation to state that Vue’s
__VUE_OPTIONS_API__ flag defaults to false, while preserving the exception that
an explicit vue.optionsApi: true setting enables it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f9a0f109-244f-4333-b4fb-43cae5fce28d
📒 Files selected for processing (8)
docs/1.getting-started/18.upgrade.mdpackages/schema/src/config/app.tspackages/schema/src/config/vite.tspackages/schema/src/types/schema.tspackages/webpack/src/presets/vue.tstest/bundle.test.tstest/fixtures/basic/nuxt.config.tstest/fixtures/runtime-compiler/nuxt.config.ts
|
|
||
| #### What Changed | ||
|
|
||
| With `compatibilityVersion: 5`, Nuxt sets Vue's [`__VUE_OPTIONS_API__`](https://vuejs.org/api/compile-time-flags#VUE_OPTIONS_API) feature flag to `false`, which compiles Vue's Options API runtime out of the client bundle. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Clarify that this is the default, not an unconditional value.
The resolver preserves an explicit vue.optionsApi: true, so this should say the flag defaults to false with compatibilityVersion: 5 unless the option is explicitly enabled.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/1.getting-started/18.upgrade.md` at line 599, Update the
compatibilityVersion: 5 documentation to state that Vue’s __VUE_OPTIONS_API__
flag defaults to false, while preserving the exception that an explicit
vue.optionsApi: true setting enables it.
Nuxt 5 disables Vue's Options API by default (nuxt/nuxt#35791), which turns `app.mixin()` into a silent no-op. Before we replace the mixin with a runtime mechanism, this PR pins down what it does today, so the replacement can be proven behavior-preserving. No SDK code changes. - Unit tests document that the root component is always tracked, per hook (`create`, `update`, `activate`), and that spans are keyed by operation. - vue-3 and nuxt-4 e2e now assert the root spans (`Application Render`, `Vue <Root>`). - nuxt-5 drops the `vue: { optionsApi: true }` escape hatch, so it now shows the Nuxt 5 default (tests are marked `test.fail`) Reference: #23375
…24174) Nuxt 5 disables Vue's Options API by default (nuxt/nuxt#35791). That turns `app.mixin()` into a silent no-op, and every Vue UI span comes from that mixin: `Application Render` and `Vue <Root>` disappear with no signal. When the mixin is dropped, the SDK now wraps `app.mount()` and calls the same mixin hook bodies, so the default spans stay identical. The Nuxt SDK additionally extends the root span until `<Suspense>` resolves. `trackComponents` still needs the Options API and warns when it is lost. Vue 2 behavior stays unchanged (always needs Options API as it's not possible otherwise). Closes #23375 Docs follow-up: getsentry/sentry-docs#19290
🔗 Linked issue
📚 Description
as most users of Nuxt are probably using
<script setup>rather than the Options API, this disables Options API use by default.it's straightforward to re-enable if you are using it, and it saves ~6/7kB for people who aren't: