From 9d4d11cc43f2ae149ee8bfcf28285a1f62594ef7 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Tue, 7 Nov 2023 11:29:10 -0500 Subject: [PATCH] fix(@angular-devkit/build-angular): allow SSR compilation to work with TS allowJs option When using the `application` builder with SSR enabled and the `allowJs` TypeScript option, the build would previously generate warnings about undefined imports. This was caused by the recently introduced initialization error handling that was not accounting for the early exit of the SSR compiler plugin's `onStart` hook. This early exit prevent the error status checking from completing which resulted in the SSR plugin load hook assuming an error had occurred. This in turn caused JavaScript files that were not imported into TypeScript files to be returned as empty content to avoid the not found error message. To remedy this situation, the error status is now also set during the SSR early exit. (cherry picked from commit 3470bff732aca3a6f0d14cd806e60db1992d77e5) --- .../build_angular/src/tools/esbuild/angular/compiler-plugin.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/angular_devkit/build_angular/src/tools/esbuild/angular/compiler-plugin.ts b/packages/angular_devkit/build_angular/src/tools/esbuild/angular/compiler-plugin.ts index b9dadb69550c..9ddc95f7d114 100644 --- a/packages/angular_devkit/build_angular/src/tools/esbuild/angular/compiler-plugin.ts +++ b/packages/angular_devkit/build_angular/src/tools/esbuild/angular/compiler-plugin.ts @@ -264,6 +264,7 @@ export function createCompilerPlugin( if (compilation instanceof NoopCompilation) { await sharedTSCompilationState.waitUntilReady; + hasCompilationErrors = false; return result; }