Cannot find module ‘@/xx/...‘ or its corresponding type declarations.Vetur(2307)

第一个可能原因

  没有配置alias

  请参考官方文档:

FAQ | VeturVue tooling for VS Code.https://vuejs.github.io/vetur/guide/FAQ.html#vetur-can-t-recognize-components-imported-using-webpack-s-alias配置了之后如果没生效,继续往下看

第二个可能原因

     没有将项目放在第一个,也就是说你的 vscode 打开的必须是你的项目,而不是一个文件夹里边包含你的项目

如果不想这样做,那就继续往下看

第三个解决方法

    请参考官方文档:

    在你的根目录创建 vetur.config.js,并且在 projects 属性配置你的项目

vetur.config.js | VeturVue tooling for VS Code.https://vuejs.github.io/vetur/reference/#example

 记得这个配置完了之后,需要重新启动一下 vetur 插件

参考了多个 csdn 文章,我这里做个总结,希望大家给我顶上去

猜你喜欢

转载自blog.csdn.net/weixin_42335036/article/details/120483401