TS - Vite 配置了路径别名还是提示模块未找到
Vite 中配置:
export default defineConfig(({ command, mode }) => {
return {
resolve: {
lit:[alias: {
"@root": path.resolve(__dirname, "src"),
"@admin": path.resolve(__dirname, "src/projects/admin"),
"@client": path.resolve(__dirname, "src/projects/client")
}]:lit
}
};
});
tsconfig 中配置:
{
"compilerOptions": {
"baseUrl": ".",
lit:["paths": { "@admin/*": ["src/projects/admin/*"], "@client/*": ["src/projects/client/*"], "@root/*": ["src/*"] }]:lit
}
}