0

I have a workspace with several apps like: project1 and project2 etc. My tsconfig.json defines some common path aliases, like:

"compilerOptions": {
    "outDir": "../../out-tsc/app",
    "baseUrl": "./src/",
    "paths": {
        "@app/*": ["app/*"],
        "@lib/*": ["app/lib/components/*"],
        "@core/*": ["app/core/*"],
        "@shared/*": ["app/shared/*"],
    }
}

But now I also need to setup some project specific path aliases and need to "overwrite" a path alias, So I created for the projects specific tsconfig.app.json files, like:

Project 1:

"extends": "../../tsconfig.json",
"compilerOptions": {
    "outDir": "../../out-tsc/app",
    "baseUrl": "./src/",
    "paths": {
        "@core/*": ["../project1/core/*"],
        ...
    }
}

Project 2:

"extends": "../../tsconfig.json",
"compilerOptions": {
    "outDir": "../../out-tsc/app",
    "baseUrl": "./src/",
    "paths": {
        "@core/*": ["../project2/core/*"],
        ...
    }
}

Now I ran into two issues: either VSCode doesn't read the tsconfig.app.json and throws errors or angular doesn't work correctly because the overwrite is not resolved in the correct way.

What can I do to fix this? Unfortunately, because of the code structure changing @core into @core1 etc. is no option.

Lars
  • 920
  • 1
  • 14
  • 34
  • 1
    Please take a look over here https://stackoverflow.com/questions/53173306/visual-studio-code-cant-resolve-angulars-tsconfig-paths – ktsangop Apr 27 '23 at 08:00

0 Answers0