You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@vizejs/vite-plugin silently compiles a withDefaults() default factory that references a
locally-declared <script setup> const (e.g. { presets: () => DEFAULT_PRESETS } where
DEFAULT_PRESETS is a local const). This is invalid — defineProps()/withDefaults() are hoisted
out of setup(), so the factory can't close over setup()-local bindings.
Expected behavior
Vize's compiler should reject this pattern at build time, matching @vue/compiler-sfc's checkInvalidScopeReference behavior
Environment
OS: browser-based reproduction via Vize Playground, OS not relevant
Area
Vite plugin
Version
0.294.0
Minimal reproduction
https://vizejs.dev/play/?tab=inspector#inspector=%7B%22version%22%3A1%2C%22target%22%3A%22dom%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%3E%5Cnimport%20%7B%20computed%2C%20watch%20%7D%20from%20'vue'%5Cn%5Cnconst%20items%20%3D%20%5B%5D%5Cn%5CnwithDefaults(defineProps%3C%7B%5Cn%20%20items%3F%3A%20string%5B%5D%5Cn%7D%3E()%2C%20%7B%20items%20%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%5Cn%3Cstyle%20scoped%3E%5Cn.card%20%7B%5Cn%20%20padding%3A%201rem%3B%5Cn%20%20border%3A%201px%20solid%20%2342d392%3B%5Cn%20%20border-radius%3A%208px%3B%5Cn%7D%5Cnbutton%3Adisabled%20%7B%5Cn%20%20opacity%3A%200.5%3B%5Cn%20%20cursor%3A%20not-allowed%3B%5Cn%7D%5Cn%3C%2Fstyle%3E%22%7D%5D%7D
Actual behavior
@vizejs/vite-plugin silently compiles a withDefaults() default factory that references a
locally-declared <script setup> const (e.g.
{ presets: () => DEFAULT_PRESETS }whereDEFAULT_PRESETS is a local const). This is invalid — defineProps()/withDefaults() are hoisted
out of setup(), so the factory can't close over setup()-local bindings.
Expected behavior
Vize's compiler should reject this pattern at build time, matching @vue/compiler-sfc's
checkInvalidScopeReference behavior
Environment
Before submitting