Open hairyf opened 3 years ago
node_modules
or
yarn vite --force
I also encountered this kind of problem. Could you please tell me how to solve it
- Remove
node_modules
- Reinstall dependency packages
or
yarn vite --force
It doesn't solve the problem
我想我知道了,怎么会出现这个问题。
因为我只安装 vue
这个包。
但是我导入却不是从 vue
导入的。
比如:
import { defineComponent } from '@vue/runtime-core'
就会报上面的错误。
首先 vite
发现了新的包,然后会去走一遍流程(优化流程吧,我也不是很理解这块),虽然终端没有报错,但是依赖优化的流程已经走一遍了,并且在本地有了缓存,页面上也出现了上面的报错问题。
正确的导入应该是从 vue
导入:
import { defineComponent } from 'vue'
并且你还要刷新一下缓存,重新编译:yarn vite --force
英语不好,就不机翻了,见谅。。
关于自动导入错误,可能跟以下有关:Volar 插件、VSCode 本身,配置出现了问题,导致自动导入的来源不对劲。
Version
vue: 3.0.7 vite: 2.0.5 vuedraggable: 4.0.1
Steps to reproduce
npm run dev
What is expected?
The page is displayed normally
What is actually happening?
Page crash