第一步
vite.config.ts
alias: {
"@": resovePath("src"),
},
第二步
tsconfig.json
"compilerOptions": {
...
"baseUrl": "./",
"paths":{
"@": ["src"],
"@/*": ["src/*"],
}
},
解决ts 和 vue 文件的相互导入找不到模块
根目录 或 src 下新建 env.d.ts 文件
declare module "*.vue" {
import { defineComponent } from "vue";
const Component: ReturnType<typeof defineComponent>;
export default Component;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)