Template ref with conflicting name works in dev but not in prod
Vue version
3.2.41
Link to minimal reproduction
Steps to reproduce
- Create a component with a template named the same as a prop
<script setup>
import { ref } from 'vue'
defineProps({
msg: {
type: String,
default: 'default message'
}
})
</script>
<template>
<h1 ref="msg">Hello</h1>
</template>
- Run the app in dev
- Build the app and run in prod
What is expected?
It should work or not but it should have same behavior between dev and prod mode
What is actually happening?
It work in dev mode
It doesn't work in prod with an error msg is not defined
making it a bit difficult to debug
System Info
No response
Any additional comments?
No response
I recommend write like this。In fact,component receive msg
is type of Object
https://sfc.vuejs.org/#eNqFUctuwjAQ/JWVL1CJ2KLtyQqIqlLVW/sBvkBYIDR+yN5QVSj/3k1CI5pK9ObdGc/YM2fxFII81Si0yFMRy0CQkOqwNK60wUeCc8RdA7voLRjBTCMG6Nnb0CMTqdqhVZoYV3iXCF68hwXw7amrq+rOuFz1DqzNA6EN1ZqQJ4C8k9I27RdG8EUjlnmnyGiuBqqYid46s+sgj8k7fve5FTAXIBmhodu0u+65mg8HopC0UrULH3tZeKtWjKlYOyotZltvVw/yXj7O1bZMdL2XmGy2if4zYWRHI2ZX4oqXJ4xZRLfFiPGm2Yj7y3CE/TFtPRvjGg7gJ+cbjbWhw6WzSV+JYeFd6fA9+pCmXUAc9hAVfQXU8LY5YkGXDzJ/XVfEFDbu3f/p8DAHzc7cIEtzg69YVT5Xh/moxOYbma/ZIA==