【问题标题】:Path alias inheritance in tsconfig for Angular/NX ProjectAngular/NX 项目的 tsconfig 中的路径别名继承
【发布时间】:2022-01-07 05:30:38
【问题描述】:

我想知道在 Angular/NX 项目中是否有可能在 tsconfig -> compilerOptions -> 路径中拥有全局路径别名,并且在每个项目中都有通过扩展继承的本地路径别名?或者全局路径别名是否被本地应用路径别名覆盖?

如果它们被覆盖,是否意味着我必须在每个应用程序中有重复的定义才能引用例如库?

【问题讨论】:

    标签: angular tsconfig nrwl-nx


    【解决方案1】:

    如果您删除本地路径别名,则全局路径别名将被覆盖。我很难过。

    因此,如果您在扩展全局 tsconfig 的模块之一中有 tsconfig:

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

    如果您进行扩展并且包含路径,则全局 tsconfig 中的所有别名都将可用。

    【讨论】:

      猜你喜欢
      • 2023-03-18
      • 2020-01-27
      • 2022-01-12
      • 1970-01-01
      • 2022-08-06
      • 2021-07-16
      • 2019-07-20
      • 2019-03-03
      • 1970-01-01
      相关资源
      最近更新 更多