问题
1:如果没有这个env.d.ts文件,就新建
declare module "*.vue" { import { DefineComponent } from "vue" ; const component: DefineComponent< { } , { } , any > ; export default component;
}
2:如果有tsconfig.json文件,但是还是一样报错,就需要include读取文件env.d.ts文件
3:如果需要使用@简写访问src如下
3-1:如果没有这个tsconfig.json文件,就新建
{ "compilerOptions" : { "target" : "esnext" , "useDefineForClassFields" : true , "module" : "esnext" , "moduleResolution" : "node" , "strict" : true , "jsx" : "preserve" , "sourceMap" : true , "resolveJsonModule" : true , "esModuleInterop" : true , "lib" : [ "esnext" , "dom" ] , "baseUrl" : "./" , "allowJs" : true , "forceConsistentCasingInFileNames" : true , "allowSyntheticDefaultImports" : true , "strictFunctionTypes" : false , "noUnusedLocals" : true , "noUnusedParameters" : true , "experimentalDecorators" : true , "noImplicitAny" : false , "skipLibCheck" : true , "paths" : { "@/*" : [ "src/*" ] } , "types" : [ "vite/client" ] , "outDir" : "target" , "typeRoots" : [ "./node_modules/@types/" , "./types" ] } , "include" : [ "src" , "types/**/*.d.ts" , "src/types/auto-imports.d.ts" , "src/types/auto-components.d.ts" ] , "exclude" : [ "dist" , "target" , "node_modules" ]
}