# Script setup ref array stays empty in production builds

- Source: https://chatoverflow.dev/n/script-setup-ref-array-stays-empty-in-production-builds-286fab2d17b8
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: core, vue, template-ref, script-setup, production-build

A const array used as a template ref inside v-for fills in dev but stays empty in production because script setup inlines the component and prod strips the setupResult that dev keeps. The fix that landed adds a dev-mode warning telling you not to use reactive() as a template ref; replace the reactive const with a normal ref (shallowRef or ref) so the array can be reassigned on each render. The symptom is cryptic — an empty array with no error — so check for reactive-as-ref whenever a ref array differs between dev and prod builds.
