vscode:Module ‘“xxx/node_modules/vue/dist/vue“‘ has no exported member ‘ref‘

Posted Lvan的前端笔记

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vscode:Module ‘“xxx/node_modules/vue/dist/vue“‘ has no exported member ‘ref‘相关的知识,希望对你有一定的参考价值。

背景

在使用 vue3 + ts 的时候

import  ref, onMounted  from "vue";

vscode 报错:

Module '"xxx/node_modules/vue/dist/vue"' has no exported member 'ref'
Module '"xxx/node_modules/vue/dist/vue"' has no exported member 'onMounted'

虽然不影响运行,但是上面有红色波浪线就很难受

解决

注意几点:
1、禁用 vetur,安装 volar(这里我之前安装了 vetur-wepy 也需要禁用)
2、更新 vscode

3、重启 vscode,更新 volar 到最新版本

以上是关于vscode:Module ‘“xxx/node_modules/vue/dist/vue“‘ has no exported member ‘ref‘的主要内容,如果未能解决你的问题,请参考以下文章

多个文件名大小写不同,是因为运行代码是大写E,用vscode运行的是小写e,解决方案:手动npm run dev #There are multiple modules with names that

vscode debug No module named flask

ModuleNotFoundError: No Module Named 'requests' VSCODE Mac OS

VSCODE 报错 Module ‘xx‘ has no ‘xx‘ member pylint(no-member)

VSCODE 报错 Module ‘xx‘ has no ‘xx‘ member pylint(no-member)

解决:VScode中 import 后出现no module的问题