Vue3
hua_ban_yu
这个作者很懒,什么都没留下…
展开
-
vue3使用import引入组件报Internal server error: Failed to resolve import “@/components/xxx“错误
使用vue3 + ts搭建项目,引入vue组件时报,[vite] Internal server error: Failed to resolve import "@/components/home/HomeSearch" from "src/views/HomeView.vue". Does the file exist?原因:直接引入vue组件但没有在vite.config.ts文件配置扩展。方案1、在vite.config.ts文件中添加扩展,保存后重新运行即可。引入组件添加.vue后缀,如图。原创 2024-04-15 18:42:16 · 3132 阅读 · 0 评论 -
Cannot find module ‘../views/xx.vue‘ or its corresponding type declarations.ts
解决方案:在项目根目录下的env.d.ts文件里面输入如下代码。原因:因为ts只能解析 .ts 文件,无法解析 .vue文件。原创 2024-04-10 19:40:42 · 502 阅读 · 0 评论