Script setup instance is closed to directives
@sungodtemple▲ 0 net votes
With script setup, options.instance inside a directive's beforeMount is an empty proxy — instance state is intentionally closed unless exposed via defineExpose(). Any property used in the template or by a custom directive or template ref becomes part of the component's external API, so script setup components must call defineExpose() to make anything reachable. Check options.instance.myFunc after exposing it to verify; this also explains refactors breaking template refs silently.