Skip to content

Directives/components with generic type parameters may always be considered affected, even when not changed #42543

@SebastianPodgajny

Description

@SebastianPodgajny

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

Description

I've created empty angular app with two lazy loaded modules, first module (M1) has one component with no dependencies second one (M2) imports our (quite big) UI library
import { Component, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

@Component({
  template: `M1`,
})
export class M1Component {}

@NgModule({
  declarations: [M1Component],
  imports: [RouterModule.forChild([{ path: '', component: M1Component }])],
})
export class M1Module {
  constructor() {
    console.log(2);
  }
}
import { Component, NgModule } from "@angular/core";
import { RouterModule } from "@angular/router";
import { ButtonModule } from "@xyz/user-interface";    <--- this is path mapped in tsconfig to TS files

@Component({
  template: `M2`
})
export class M2Component {}


@NgModule({
  declarations: [M2Component],
  imports: [
    ButtonModule,
    RouterModule.forChild([
      {path: '', component: M2Component}
    ])
  ]
})
export class M2Module {}

After changing console.log(x) to console.log(y) in M1Module IncrementalCompilation marks this files as physicallyChangedTsFiles

apps/build-test/src/app/m1.module.ts
libs/user-interface/src/lib/forms/select/select.component.ts
libs/user-interface/src/lib/data-table/data-table/data-table.component.ts

then this is marked as logicallyChangedTsFiles

apps/build-test/src/app/m1.module.ts
libs/user-interface/src/lib/forms/select/select.module.ts
libs/user-interface/src/lib/data-table/data-table.module.ts
libs/user-interface/src/lib/forms/select/select.component.ts
libs/user-interface/src/lib/data-table/data-table/data-table.component.ts

and then in AngularWebpackPlugin.updateAotProgram I have affectedFiles

apps/build-test/src/app/m1.module.ts
libs/user-interface/src/lib/core/overlay/generic-component-type.ts
libs/user-interface/src/lib/core/overlay/position/position-strategy.ts
libs/user-interface/src/lib/core/overlay/scroll/interface.ts
libs/user-interface/src/lib/icons-container/icons.type.ts
libs/user-interface/src/lib/common/avatar/avatar.types.ts
libs/worker/src/lib/helpers.ts
libs/worker/src/lib/interfaces.ts
libs/worker/src/lib/common.worker.ts
libs/worker/src/index.ts
libs/user-interface/src/lib/dialog/dialog.component.ts
libs/user-interface/src/lib/pdf-viewer/pdf-viewer.types.ts
libs/user-interface/src/lib/forms/file-upload/attachment-item/attachment-item.types.ts
libs/user-interface/src/lib/forms/file-upload/attachment-placeloader/attachment-placeloader.types.ts
libs/user-interface/src/lib/forms/select/select.component.ts
libs/user-interface/src/lib/forms/select/select.module.ts
libs/user-interface/src/lib/data-table/data-table/data-table.component.ts
libs/user-interface/src/lib/data-table/data-table.module.ts

In this compilation typescript state.changedFilesSet has only one entry which is

apps/build-test/src/app/m1.module.ts

🔬 Minimal Reproduction

🔥 Exception or Error





🌍 Your Environment




Angular CLI: 12.0.3
Node: 14.16.1
Package Manager: yarn 1.21.1
OS: darwin x64

Angular: 12.0.3
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1200.3
@angular-devkit/build-angular     12.0.3
@angular-devkit/build-optimizer   0.1200.3
@angular-devkit/build-webpack     0.1200.3
@angular-devkit/core              12.0.3
@angular-devkit/schematics        12.0.3
@angular/benchpress               0.2.1
@ngtools/webpack                  12.0.3
@schematics/angular               12.0.3
ng-packagr                        12.0.3
rxjs                              6.6.3
typescript                        4.2.4

Anything else relevant?
Same thing happens on 11.2 exactly the same files are marked as affected, I guess it will be hard to debug without reproduce, maybe you can tell what might be the cause of this behaviour? Is there anything that I should check?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: compilerIssues related to `ngc`, Angular's template compilerarea: performanceIssues related to performancestate: has PR

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions