Subscribe on changes!

$toRef is not available unless $ref is also used

avatar
Jul 25th 2022

Vue version

3.2.37

Link to minimal reproduction

https://sfc.vuejs.org/#eNo9UNFqwkAQ/JXlKERBk/qapkKpBy1YFZtCH+4l6hojyd1xu9dSQv69l6T1bWdnbm9mWvFkbfzlUaQio6OrLAMhe7tU+mg0MVhnLMEjnPBcadz1aNIqDdBQmcIwAfCPxRTe2VW6nI2roC98zSlEb0hUlAiVhgIOhrnGaBB1SndTpZVOEljJtcwl5C8SNvIzh/XrRsJkvbifQr6Fvdztt6uPZxkP4tGZ157wFKzdOTxPtK/r6UN/bWSDvZ5isw/kEGIGUVhG4ccsGaOGkAEwNrYuGAMCyC6LZdsOr7suSwLq5TeJmImqscbxvClsfCWjQ3FDCeqPICVutSgRmu2xEhdmS2mS0PnY132l2LgyCVPsvOaqwRipmR+c+SZ04bAS/w2J7hcdw4ut

Steps to reproduce

  1. Write a new component that makes use of $toRef but does not use $ref
  2. You'll see the following error: $toRef is not defined

What is expected?

Transform kicks in when $toRef is used.

What is actually happening?

Transformation of $toRef does not happen unless the same file uses $ref.

It does not seem to matter whether $ref is used in a commented line of code.

System Info

No response

Any additional comments?

Related discussion: https://github.com/vuejs/rfcs/discussions/369#discussioncomment-3204419

avatar
Aug 19th 2022

Maybe this issue has fixed

avatar
Aug 31st 2022

Maybe this issue has fixed

I don't think so, I've just tested against v3.2.38.

avatar
Jan 26th 2023

Unfortunately, Reactivity Transform has been dropped officially now, so I closed this issue/PR. If you want to keep using it, please consider the community version Vue Macros.


This PR has been merged to Vue Macros https://github.com/sxzz/unplugin-vue-macros/commit/8cc7b4cec38034540f7fecae0626965a9b1e7171.