找不到模块“./App.vue”或其相应的类型声明
tsconfig.json 里面设置
"compilerOptions": {
"target": "esnext" ,
"module": "esnext",
"moduleResolution": "node",
"jsx": "preserve",
"include": ["src/**/*.ts", "src/**/*.vue", "src/**/*.tsx", "src/**/*.d.ts"]
}
在 src 目录下创建env.d.ts文件,填入以下内容即可
/// <reference types="vite/client" />
declare module '*.vue' {
import { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}