Subscribe on changes!

Ref sugar does not add correctly the .value in certain cases when compiling (Vue 3.0.9)

avatar
Mar 29th 2021

Version

3.0.9

Reproduction link

https://github.com/IonianPlayboy/vue-3.0.9-ref-sugar-bug-repro

Steps to reproduce

There is maybe other ways to trigger the bug, but the one I found was to :

  1. Declare a new string ref named msg with the ref: syntax
  2. Try to use the .match() method on it

What is expected?

msg.match(...) is converted to msg.value.match(...) during compilation

What is actually happening?

msg.match(...) is not changed, causing the following error in the browser console : TypeError: msg.match is not a function


The repro was generated with npm init @vitejs/app, choosing the vue-ts template. I did not try to build the project to see if it was also bugged in production, but it certainly fails in dev. Downgrading to version 3.0.7 solves the issue.

avatar
Mar 29th 2021

Duplicate of #3510