Skip to content

feat(nuxt): support vue vapor - #35759

Merged
danielroe merged 25 commits into
mainfrom
vapor
Aug 14, 2026
Merged

danielroe merged 25 commits into
mainfrom
vapor

Conversation

@danielroe

@danielroe danielroe commented Jul 20, 2026 •

Copy link
Copy Markdown
Member

🔗 Linked issue

resolves #32859

📚 Description

Note

it is already possible to use vue vapor with nuxt (see demo)

this is a PR to track full support for vue vapor (preview in Vue v3.6.0-rc.3).

it adds tests for vapor so we can track what is supported

Important

if you want to play around with this, note that you will need to make sure you install "vue": "^3.6.0-rc.3" in your package.json as well as enable vue.vapor in your nuxt.config. and note that this branch targets nitro v3 and nuxt v5 (but will be backported to nuxt v4). so play around with it in a fresh project rather than installing it in an existing one.

Vue-side (upstream)

🚧 TODO

  • no vapor exports under vue's node condition (vaporInteropPlugin is undefined server-side; nuxt works around with a client-only plugin, see the TODO in packages/nuxt/src/app/plugins/vapor-interop.client.ts)

Nuxt-side

  • auto-import loader: rewrite _createAssetComponent (vapor codegen) to direct imports
  • experimental vue.vapor option installing vaporInteropPlugin
  • vapor-aware useAsyncData (onServerPrefetch registration, onBeforeMount fallback, NUXT_E3003 false positive)
  • definePageMeta runtime warning false positive in vapor components
  • detached-scope useRoute test regression under vue 3.6 (alien-signals; not vapor-specific)
  • audit getCurrentInstance() usage for vapor (most sites already safe; the dev-diagnostic sites now share an isInComponentSetup scope discriminator)
  • slot inspection made vapor-safe (isVaporSlot() helper branches before calling the slot; warns where a vapor slot can't
    express the VNode content a built-in needs)
  • keyed onPrehydrate now warns instead of silently degrading without a vdom instance
  • docs for vue.vapor + known limitations

@github-actions github-actions Bot added 5.x ✨ enhancement New feature or improvement to existing functionality labels Jul 20, 2026
@codspeed

This comment was marked as duplicate.

@danielroe
danielroe force-pushed the vapor branch 3 times, most recently from 50c853d to a1c0f05 Compare July 20, 2026 22:27
@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@35759

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@35759

nuxt

npm i https://pkg.pr.new/nuxt@35759

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@35759

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@35759

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@35759

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@35759

commit: 9b07e10

@danielroe
danielroe force-pushed the vapor branch 3 times, most recently from c2f7b7f to 3a29590 Compare July 20, 2026 23:14
@danielroe danielroe added this to the 4.6 milestone Jul 21, 2026
@danielroe danielroe added the 4.x label Jul 21, 2026
@danielroe
danielroe force-pushed the vapor branch 2 times, most recently from 5581615 to 1c338ba Compare July 22, 2026 09:44
@danielroe
danielroe marked this pull request as ready for review July 22, 2026 22:55
@coderabbitai

This comment has been minimized.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
test/e2e/vapor.test.ts (1)

144-226: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Inconsistent toHaveNoErrorsOrWarnings() coverage in vapor async data tests.

Within this describe block, tests at L134-142 and L155-165 assert expect(page).toHaveNoErrorsOrWarnings(), but the tests at L144-153, L167-173, L175-186, L188-198, L200-210, L212-218 and L220-226 don't. Unlike the <NuxtErrorBoundary> tests further down (which intentionally trigger errors), nothing here should produce console errors/warnings, so the missing assertions leave a gap that could hide hydration/console regressions introduced by future vapor async-data changes.

Example fix for one of the affected tests
   test('ssr + hydration of awaited useAsyncData in a vapor page, with refresh', async ({ page, goto }) => {
     await goto('/async-data')
     await expect(page.getByTestId('data-greeting')).toHaveText('hello from api')
     await expect(page.getByTestId('data-status')).toHaveText('success')

     const countText = await page.getByTestId('data-count').textContent()
     await page.getByTestId('refresh-button').click()
     await expect(page.getByTestId('data-count')).not.toHaveText(countText!)
     await expect(page.getByTestId('data-status')).toHaveText('success')
+
+    expect(page).toHaveNoErrorsOrWarnings()
   })

Apply the same pattern to the other affected tests in this block.

🤖 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 `@test/e2e/vapor.test.ts` around lines 144 - 226, Add
expect(page).toHaveNoErrorsOrWarnings() to each affected vapor async-data test
in this describe block, including the SSR/hydration, navigation, lazy-data,
async-setup, prefetch, refresh, and vdom-to-vapor cases. Keep the existing
assertions unchanged and apply the same console-error/warning check already used
by the neighboring tests.
🤖 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 `@packages/nuxt/src/app/components/nuxt-teleport-island-component.ts`:
- Around line 48-53: The unsupported Vapor-slot check in
nuxt-teleport-island-component.ts must short-circuit before slots.default()[0]
and slot.type are accessed; retain the development diagnostic while routing
unsupported slots through the existing fallback/error behavior in all
environments. In client-fallback.server.ts, skip ssrRenderVNode for the same
unsupported Vapor-slot case so both sites consistently avoid VNode-only
processing.

In `@packages/nuxt/src/pages/runtime/composables.ts`:
- Around line 77-80: Update the early return in the definePageMeta runtime
warning path so it only suppresses NUXT_E1007 for Vapor route components, not
every context reported by hasInjectionContext(). Use an existing Vapor-specific
signal if available, or add coverage confirming that calls from runWithContext,
plugins, and other injection callbacks still emit the warning while valid Vapor
route components remain exempt.

In `@packages/webpack/src/presets/base.ts`:
- Around line 168-173: Update baseResolve to merge configured
webpack.resolve.alias entries with the generated ctx.alias map rather than
allowing ctx.config.resolve to replace it. Preserve the generated Vue aliases
from baseAlias while applying user aliases, with user values taking precedence
only for matching keys.

In `@pnpm-workspace.yaml`:
- Around line 53-54: Replace the broad `@vue/`* release-age exemption in the
workspace configuration with exact package/version exclusions for only the
required Vue RC packages. Keep the existing vue exemption if needed, and ensure
newly published Vue packages remain subject to minimumReleaseAge.

---

Nitpick comments:
In `@test/e2e/vapor.test.ts`:
- Around line 144-226: Add expect(page).toHaveNoErrorsOrWarnings() to each
affected vapor async-data test in this describe block, including the
SSR/hydration, navigation, lazy-data, async-setup, prefetch, refresh, and
vdom-to-vapor cases. Keep the existing assertions unchanged and apply the same
console-error/warning check already used by the neighboring tests.
🪄 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: 88dfef2f-4802-4be5-9bce-3ad22068421f

📥 Commits

Reviewing files that changed from the base of the PR and between b656203 and 1c338ba.

⛔ Files ignored due to path filters (2)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
  • test/fixtures/vapor/package.json is excluded by !**/package.json
📒 Files selected for processing (70)
  • docs/3.guide/1.concepts/10.vuejs-development.md
  • packages/nuxt/src/app/components/client-fallback.server.ts
  • packages/nuxt/src/app/components/client-only.ts
  • packages/nuxt/src/app/components/nuxt-layout.ts
  • packages/nuxt/src/app/components/nuxt-teleport-island-component.ts
  • packages/nuxt/src/app/components/utils.ts
  • packages/nuxt/src/app/composables/asyncContext.ts
  • packages/nuxt/src/app/composables/asyncData.ts
  • packages/nuxt/src/app/composables/payload.ts
  • packages/nuxt/src/app/composables/router.ts
  • packages/nuxt/src/app/composables/ssr.ts
  • packages/nuxt/src/app/diagnostics/core.ts
  • packages/nuxt/src/app/diagnostics/head.ts
  • packages/nuxt/src/app/diagnostics/render.ts
  • packages/nuxt/src/app/nuxt.ts
  • packages/nuxt/src/app/plugins/vapor-interop.client.ts
  • packages/nuxt/src/components/plugins/loader.ts
  • packages/nuxt/src/core/nuxt.ts
  • packages/nuxt/src/head/runtime/components.ts
  • packages/nuxt/src/pages/runtime/composables.ts
  • packages/nuxt/test/auto-imports.test.ts
  • packages/nuxt/test/component-loader.test.ts
  • packages/schema/src/config/app.ts
  • packages/schema/src/types/schema.ts
  • packages/webpack/src/presets/base.ts
  • pnpm-workspace.yaml
  • test/bundle.test.ts
  • test/e2e/vapor.test.ts
  • test/fixtures/vapor/app/app.vue
  • test/fixtures/vapor/app/components/ServerBox.server.vue
  • test/fixtures/vapor/app/components/VaporBuiltinSlots.vue
  • test/fixtures/vapor/app/components/VaporComposables.vue
  • test/fixtures/vapor/app/components/VaporCounter.vue
  • test/fixtures/vapor/app/components/VaporCustomLink.vue
  • test/fixtures/vapor/app/components/VaporNested.vue
  • test/fixtures/vapor/app/components/VaporPlainLink.vue
  • test/fixtures/vapor/app/components/VaporThrowsHandler.vue
  • test/fixtures/vapor/app/components/VaporThrowsSetup.vue
  • test/fixtures/vapor/app/components/VaporWrapper.vue
  • test/fixtures/vapor/app/components/VdomChild.vue
  • test/fixtures/vapor/app/pages/async-await.vue
  • test/fixtures/vapor/app/pages/async-data.vue
  • test/fixtures/vapor/app/pages/client-only.vue
  • test/fixtures/vapor/app/pages/composables.vue
  • test/fixtures/vapor/app/pages/dev-only.vue
  • test/fixtures/vapor/app/pages/error-boundary.vue
  • test/fixtures/vapor/app/pages/index.vue
  • test/fixtures/vapor/app/pages/inner-transition.vue
  • test/fixtures/vapor/app/pages/island.vue
  • test/fixtures/vapor/app/pages/keepalive-vapor.vue
  • test/fixtures/vapor/app/pages/keepalive-vdom.vue
  • test/fixtures/vapor/app/pages/lazy-data.vue
  • test/fixtures/vapor/app/pages/lazy-import.vue
  • test/fixtures/vapor/app/pages/lazy.vue
  • test/fixtures/vapor/app/pages/links-custom.vue
  • test/fixtures/vapor/app/pages/links.vue
  • test/fixtures/vapor/app/pages/mixed.vue
  • test/fixtures/vapor/app/pages/nested.vue
  • test/fixtures/vapor/app/pages/prefetch.vue
  • test/fixtures/vapor/app/pages/slow.vue
  • test/fixtures/vapor/app/pages/vapor-page-two.vue
  • test/fixtures/vapor/app/pages/vapor-page.vue
  • test/fixtures/vapor/app/pages/vapor-slots.vue
  • test/fixtures/vapor/app/pages/vdom-async-data.vue
  • test/fixtures/vapor/app/pages/vdom-page.vue
  • test/fixtures/vapor/app/types.d.ts
  • test/fixtures/vapor/nuxt.config.ts
  • test/fixtures/vapor/server/api/greeting.get.ts
  • test/fixtures/vapor/server/api/hello.ts
  • test/fixtures/vapor/tsconfig.json
💤 Files with no reviewable changes (1)
  • packages/nuxt/src/app/composables/asyncContext.ts

Comment thread packages/webpack/src/presets/base.ts Resolved
Comment thread pnpm-workspace.yaml Outdated
Comment on lines +53 to +54
- vue
- '@vue/*'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Keep the release-age exemption scoped to the required Vue RC packages.

Excluding the entire @vue/* namespace allows any newly published Vue package to bypass minimumReleaseAge, weakening the supply-chain protection. Prefer exact package/version exclusions for the RC packages required by this change.

🤖 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 `@pnpm-workspace.yaml` around lines 53 - 54, Replace the broad `@vue/`*
release-age exemption in the workspace configuration with exact package/version
exclusions for only the required Vue RC packages. Keep the existing vue
exemption if needed, and ensure newly published Vue packages remain subject to
minimumReleaseAge.

@danielroe
danielroe added this pull request to the merge queue Aug 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 9, 2026
@danielroe
danielroe added this pull request to the merge queue Aug 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 9, 2026
@danielroe
danielroe enabled auto-merge August 14, 2026 07:06
@danielroe
danielroe added this pull request to the merge queue Aug 14, 2026
Merged via the queue into main with commit 1397500 Aug 14, 2026
37 checks passed
@danielroe
danielroe deleted the vapor branch August 14, 2026 07:37
This was referenced Aug 14, 2026
danielroe added a commit that referenced this pull request Aug 14, 2026
@github-actions github-actions Bot mentioned this pull request Aug 12, 2026
danielroe added a commit that referenced this pull request Aug 14, 2026
@EduardoMateos

Copy link
Copy Markdown

@danielroe

Is there a plan for Nuxt to eventually support a fully Vapor-based application, eliminating the Virtual DOM entirely?

The current Vapor Mode support is great for incremental adoption through interop mode, but I’m wondering whether the long-term goal is to allow the Nuxt app root and Nuxt internals themselves to run entirely on Vapor, without relying on VDOM/VNodes.

Is this something on the Nuxt roadmap, or is the interop approach intended to remain the long-term architecture?

thanks you!

@danielroe

Copy link
Copy Markdown
Member Author

@EduardoMateos i have spent some time on it and have a wip of a pure vapor nuxt app locally.

it is something we'd be interested in but pure vapor currently does not support a number of key features you'd want, for example suspense outside interop, so it is extremely limited. i suspect vapor needs to mature further before a pure vapor nuxt app will be beneficial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.x 5.x ✨ enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vapor Task Tracking

2 participants