Skip to content

fix(vapor): return bindings for render in normal script in vapor inline mode - #15780

Merged
edison1105 merged 2 commits into
vuejs:minorfrom
meta-syntax:fix/vapor-inline-default-export-render
Oct 12, 2026
Merged

edison1105 merged 2 commits into
vuejs:minorfrom
meta-syntax:fix/vapor-inline-default-export-render

Conversation

@meta-syntax

Copy link
Copy Markdown

Ports the fix of #4980 to Vapor.

When an SFC has no <template>, a render option in the export default of a normal <script>, and <script setup vapor>, the render receives no bindings in a production build. ctx.msg is undefined.

#4980 made compileScript build the bindings object ({ msg }) in inline mode when there is no template and the default export has render. In Vapor inline mode, however, compileScript does not prepend return to it, because the inlined template code generates its own return.
So setup ends with { msg }, which is parsed as a block statement, and returns undefined.

This PR prepends return in Vapor inline mode as well when there is no template and the default export has render, the same condition as the #4980 branch.

Reproduction

  1. An SFC with no <template>, a normal <script> whose export default has a render option, and <script setup vapor> that declares const msg = 'hello'
  2. Compile it with inlineTemplate: true (the default for production builds in @vitejs/plugin-vue)
  3. Mount it with createVaporApp
  4. render receives no msg and renders msg=undefined, with the warning Property "msg" was accessed during render but is not defined on instance.

It works with inlineTemplate: false. In the VDOM mode, the same SFC with a plain <script setup> compiles to return { msg } even with inlineTemplate: true.

The added test fails without the fix.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e2d721c6-764d-4650-9f36-d49a00e54429

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@15780
npm i https://pkg.pr.new/@vue/compiler-core@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@15780
npm i https://pkg.pr.new/@vue/compiler-dom@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@15780
npm i https://pkg.pr.new/@vue/compiler-sfc@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@15780
npm i https://pkg.pr.new/@vue/compiler-ssr@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@15780
npm i https://pkg.pr.new/@vue/compiler-vapor@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@15780
npm i https://pkg.pr.new/@vue/reactivity@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@15780
npm i https://pkg.pr.new/@vue/runtime-core@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@15780
npm i https://pkg.pr.new/@vue/runtime-dom@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@15780
npm i https://pkg.pr.new/@vue/runtime-vapor@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@15780
npm i https://pkg.pr.new/@vue/server-renderer@15780
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@15780
npm i https://pkg.pr.new/@vue/shared@15780
yarn add https://pkg.pr.new/@vue/[email protected]

vue

pnpm add https://pkg.pr.new/vue@15780
npm i https://pkg.pr.new/vue@15780
yarn add https://pkg.pr.new/[email protected]

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@15780
npm i https://pkg.pr.new/@vue/compat@15780
yarn add https://pkg.pr.new/@vue/[email protected]

commit: 3aa6fa9

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.2 kB (+1 B) 30.6 kB (+1 B) 26.9 kB (-42 B)
runtime-dom.global.prod.js 117 kB (+125 B) 43.9 kB (+54 B) 39.3 kB (+54 B)
vue.global.prod.js 177 kB (+125 B) 64 kB (+63 B) 57 kB (+46 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 53.2 kB (+106 B) 20.7 kB (+45 B) 18.9 kB (+20 B)
createApp 62 kB (+106 B) 23.9 kB (+42 B) 21.8 kB (+27 B)
createApp + vaporInteropPlugin 129 kB (+6.7 kB) 46.6 kB (+2.37 kB) 41.9 kB (+2.08 kB)
createVaporApp 34.1 kB (+3.3 kB) 13.1 kB (+1.26 kB) 12 kB (+1.15 kB)
createSSRApp 67 kB (+106 B) 26 kB (+48 B) 23.6 kB (+31 B)
createVaporSSRApp 40.8 kB (+3.73 kB) 15.5 kB (+1.43 kB) 14.2 kB (+1.3 kB)
defineCustomElement 68.5 kB (+106 B) 25.9 kB (+47 B) 23.6 kB (+57 B)
defineVaporCustomElement 48.6 kB (+2.44 kB) 17.7 kB (+925 B) 16.3 kB (+876 B)
overall 77.5 kB (+106 B) 29.5 kB (+46 B) 26.7 kB (+98 B)

@edison1105 edison1105 added the scope: vapor related to vapor mode label Oct 12, 2026
@edison1105 edison1105 changed the title fix(compiler-sfc): return bindings for render in normal script in vapor inline mode fix(vapor): return bindings for render in normal script in vapor inline mode Oct 12, 2026
@edison1105
edison1105 merged commit 0434cd4 into vuejs:minor Oct 12, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: vapor related to vapor mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants