angular 应用程序如何拥有多个 tsconfig 文件

How can we have multiple tsconfig file for angular app

根据客户要求,我们需要在一个包中包含两个独立的应用程序(link 是否会有从 appA 到 appB 的导航),以便于部署。

但是问题来了,一个部分是(带有 jquery 的打字稿),另一个是内置的 angular。

所以在结合两者时,我们只能使用一个 tsconfig。为每个应用程序指定不同的 tsconfig 路径的任何可能性。

喜欢, tsconfig1.json -> appA tsconfig2.json -> appB

任何 tsconfig 文件都可以包含 extends 属性,可用于在基本配置之上添加自定义:

https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#configuration-inheritance-with-extends

或者在 package.json 中,您可以定义特定的脚本,例如

{
  build:appA="cp tsconfig.a.json tsconfig.json && npm run build"
  build:appB="cp tsconfig.a.json tsconfig.json && npm run build"
}