我的项目有一个tsconfig,项目结构为
MyProject/src/my-files
,然后将其输出到MyProject/dist/my-files
{
"compilerOptions": {
"target": "ES2017",
"module": "commonjs",
"lib": ["es6"],
"outDir": "dist",
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"rootDirs": ["."],
"baseUrl": ".",
"paths": {
"Config/*": ["src/config/*", "dist/config/*"],
"Controllers/*": ["src/controllers/*", "dist/controllers/*"],
"Helpers/*": ["src/helpers/*", "dist/helpers/*"],
},
"skipLibCheck": true,
"types": ["node", "jest"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": ["src/**/*"]
}
有没有一种方法可以减少路径冗余
之前:paths:{ "Config/*": ["src/config/*", "dist/config/*"]...
进入:paths:{ "Config/*": ["config/*"]...
将"rootDirs": ["."],
更新为"rootDirs": ["src", "dist],
无效,并导致解析解析别名失败