找到vite-env.d.ts文件添加以下代码
/// <reference types="vite/client" />
declare module "*.vue" {
import type { DefineComponent } from "vue";
import Vue from "vue";
const component: DefineComponent<{}, {}, any> | Vue;
export default component;
}
在使用Vue3、TypeScript和Vite进行开发时,遇到提示'cannot find module'的错误,解决方案是修改vite-env.d.ts文件,添加对.vue文件的模块定义。
7728

被折叠的 条评论
为什么被折叠?



