AngularCompiler marks not related files as affected in incremental build
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 14 小時 23 分鐘
- 30 天內合併 PR
- 162
描述
### Which @angular/* package(s) are the source of the bug?
compiler-cli
### Is this a regression?
No
### Description
Any change in main.ts/m1.ts/m2.ts eg changing `console.log(1)` to `console.log(2)` will cause `src/lib/types.ts` to be included in affectedFiles (checked here https://github.com/angular/angular-cli/blob/master/packages/ngtools/webpack/src/ivy/plugin.ts#L569)
Looks like type only file is not included in ignoreForEmit Set nor included in emitted files so IncrementalCompilation can't find it previously emitted files and marks it as affected every time
### Please provide a link to a minimal reproduction of the bug
https://github.com/SebastianPodgajny/ng42543/tree/affected-type-repro
### Please provide the exception or error you saw
_No response_
### Please provide the environment you discovered this bug in
```true
Angular CLI: 12.2.1
Node: 14.16.1
Package Manager: yarn 1.21.1
OS: darwin x64
Angular: 12.2.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1202.1
@angular-devkit/build-angular 12.2.1
@angular-devkit/core 12.2.1
@angular-devkit/schematics 12.2.1
@schematics/angular 12.2.1
rxjs 6.6.7
typescript 4.3.5
```
### Anything else?
This is followup to this issue https://github.com/angular/angular/issues/42543 which was partially resolved by JoostK PR https://github.com/angular/angular/pull/42759
貢獻指南
研究方向
先在 affected-type-repro 分支上從最小重現開始,並檢查 packages/ngtools/webpack/src/ivy/plugin.ts 第 569 行附近的程式碼,接著追蹤 compiler-cli 的增量編譯如何為 main.ts、m1.ts、m2.ts 和 src/lib/types.ts 判定 affectedFiles。將 console.log(1) 改為 console.log(2) 後,types.ts 不再包含在 affectedFiles 中,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- angular, typescript
- 領域
- build-system
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100