AngularCompiler marks not related files as affected in incremental build

未关闭
#21,591 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
angular, typescript
领域
build-system

调研方向

先在 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 内容生成。

描述

area: @ngtools/webpack freq1: low severity4: memory/performance type: bug/fix
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
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

主要语言
TypeScript
星标
27k
派生
11.8k
平均合并
16 小时 35 分钟
30 天内合并 PR
176

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angular-cli 的其他 Issue

查看 angular/angular-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。