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
  }
}
posted @ 2023-08-30 16:52  Himmelbleu  阅读(9)  评论(0编辑  收藏  举报