You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to use $ref outside of a .vue file and also not sure what configuration is correct. Getting two errors:
$ref is not defined and Uncaught TypeError: Cannot read property 'call' of undefined
Cannot seem to find the right combination of configs here to use $ref in a vue file and a js file. I am not sure if I should be configuring vite or using the script block to configure the compiler, or maybe both? Can't seems to get anything to work without using the older refSugar config.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
One issue I now realize is that I was trying to export a const using $ref, which is a no-no, this also lead me to realize that named exports are not being transformed anyway. I sent in a PR to fix this here
Describe the bug
Unable to use
$ref
outside of a .vue file and also not sure what configuration is correct. Getting two errors:$ref is not defined
andUncaught TypeError: Cannot read property 'call' of undefined
Cannot seem to find the right combination of configs here to use $ref in a
vue
file and ajs
file. I am not sure if I should be configuring vite or using the script block to configure the compiler, or maybe both? Can't seems to get anything to work without using the olderrefSugar
config.Reproduction
npm init @vitejs/app
create basic vue app (not TS, didn't test)update
package.json
dependenciesnpm i
andnpm run dev
all should be goodEdit
HelloWorld.vue
remove{ref}
import from top and change ref tovite.config.js
:Uncaught TypeError: Cannot read property 'call' of undefined
HelloWorld.vue:6 Uncaught ReferenceError: $ref is not defined
**Works 🤷 **
Add
/src/useTest.js
with the following contentsAdd the following to
HelloWorld.vue
Add
{{ test }}
somewhere to the template inHelloWorld.vue
Uncaught ReferenceError: $ref is not defined
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: