AngularCompiler marks not related files as affected in incremental build

Open
#21,591 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
angular, typescript
Domain
build-system

Research direction

Start with the minimal reproduction on the affected-type-repro branch and inspect packages/ngtools/webpack/src/ivy/plugin.ts around line 569, then trace how compiler-cli incremental compilation determines affectedFiles for main.ts, m1.ts, m2.ts, and src/lib/types.ts. Done means changing console.log(1) to console.log(2) no longer includes types.ts in affectedFiles.

Written by the indexing model from the issue text.

Description

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

Dominant language
TypeScript
Stars
27k
Forks
11.8k
Avg merge
16h 35m
Merged PRs (30d)
176

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from angular/angular-cli

All issues in angular/angular-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.