Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Path alias inheritance in tsconfig for Angular/NX Project

I wonder if it is possible in a Angular/NX project to have global path aliasses in tsconfig -> compilerOptions -> paths and additionally local path aliasses in each project which are inherited with extends? Or are the global path aliasses overwritten with local app path aliasses?

If they are overwritten would that mean that I have to have duplicate definitions in each app to reference for example libs?

like image 587
Max Avatar asked Oct 15 '25 15:10

Max


1 Answers

If you delcare local path aliases, global one will be overwritten. I have hard time with it.

So if you have tsconfig in one of your modules that extend your global tsconfig:

  "extends": "../../../../tsconfig.json",
  "compilerOptions": {
     "paths":{
       // override all paths from global tsconfig.json
       }
   }

If you make extend and don't include paths, all aliases from global tsconfig will be available.

like image 106
Yodde Avatar answered Oct 17 '25 06:10

Yodde



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!