Skip to content

fix: <script setup> statements are silently dropped from Vapor codegen output #2969

Description

@AndreyYolkin

Area

Vite plugin

Version

0.294.0

Minimal reproduction

https://vizejs.dev/play/?tab=inspector#inspector=%7B%22version%22%3A1%2C%22target%22%3A%22vapor%22%2C%22selectedFile%22%3A%22src%2FApp.vue%22%2C%22options%22%3A%7B%22customRenderer%22%3Afalse%2C%22templateSyntax%22%3A%22standard%22%7D%2C%22files%22%3A%5B%7B%22path%22%3A%22src%2FApp.vue%22%2C%22source%22%3A%22%3Cscript%20setup%20lang%3D%5C%22ts%5C%22%20vapor%3E%5Cnimport%20%7B%20computed%2C%20ref%20%7D%20from%20'vue'%5Cn%5Cnconst%20item%20%3D%20ref('3')%5Cn%5Cnconst%20items%20%3D%20computed(()%20%3D%3E%20%7B%5Cn%20%20return%20%5B'1'%2C%20'2'%2C%20item%5D%5Cn%7D)%5Cn%3C%2Fscript%3E%5Cn%5Cn%3Ctemplate%3E%5Cn%20%20%3Cdiv%20class%3D%5C%22card%5C%22%3E%5Cn%20%20%20%20Items%3A%20%7B%7B%20items.join()%20%7D%7D%5Cn%20%20%3C%2Fdiv%3E%5Cn%3C%2Ftemplate%3E%5Cn%22%7D%5D%7D

Actual behavior

Vize's Vapor codegen does not carry the <script setup> body over into the compiled output. Any statement inside <script setup>, such as ref(), computed(), watch(), plain variables is simply missing from the result, and there is no setup() function emitted at all, template falls back to invalid _ctx.<name>

Expected behavior

All <script setup> statements must be preserved inside the component's setup() function, exactly as the reference Vue compiler does

Environment

  • OS: browser-based reproduction via Vize Playground, OS not relevant
  • Architecture: n/a
  • Node.js: n/a playground
  • Package manager: n/a
  • Rust: n/a
  • Framework: Vue 3.6 (Vapor mode), Vize Playground v0.294.0

Before submitting

  • I checked existing fix reports and pull requests.
  • This is not a private security report.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions