From 30638d4525b8dc260cb11488088aa7393083227a Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Thu, 8 Jul 2021 14:42:44 -0400 Subject: [PATCH] fix(@ngtools/webpack): avoid non-actionable template type-checker syntax diagnostics The AOT compiler's internal template type-checking files are not intended to be directly analyzed for diagnostics by the emitting program and are instead analyzed during the template type-checking phase. Previously, only semantic diagnostics were ignored. Now both syntactic and semantic diagnostics are ignored. This change prevents non-actionable diagnostics from being shown during a build. Addresses: https://github.com/angular/angular/issues/42667 (cherry picked from commit 720feee34f910fc11c40e2f68d919d61b7d6cbec) --- packages/ngtools/webpack/src/ivy/plugin.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ngtools/webpack/src/ivy/plugin.ts b/packages/ngtools/webpack/src/ivy/plugin.ts index 14e2b2c35931..7ba6e89bcd09 100644 --- a/packages/ngtools/webpack/src/ivy/plugin.ts +++ b/packages/ngtools/webpack/src/ivy/plugin.ts @@ -491,18 +491,18 @@ export class AngularWebpackPlugin { } } - // Collect non-semantic diagnostics + // Collect program level diagnostics const diagnostics = [ ...angularCompiler.getOptionDiagnostics(), ...builder.getOptionsDiagnostics(), ...builder.getGlobalDiagnostics(), - ...builder.getSyntacticDiagnostics(), ]; diagnosticsReporter(diagnostics); - // Collect semantic diagnostics + // Collect source file specific diagnostics for (const sourceFile of builder.getSourceFiles()) { if (!ignoreForDiagnostics.has(sourceFile)) { + diagnosticsReporter(builder.getSyntacticDiagnostics(sourceFile)); diagnosticsReporter(builder.getSemanticDiagnostics(sourceFile)); } }