Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): ensure secondary Angular compilat…
Browse files Browse the repository at this point in the history
…ions are unblocked on start errors

When using the esbuild-based builders (`application`/`browser-esbuild`), the secondary Angular compilations
will wait for the primary compilation to finish prior to bundling. This can potentially occur for polyfills
that contain TypeScript files and the server code if enabled. However, if the Angular compilation throws
an error during the start of the bundling process, the secondary compilations were never notified and instead
would wait indefinitely. To avoid this situation, the compilations will now always be notified at the end of
the compilation which will occur regardless. The build error that will be generated in these situations is
currently not ideal and more verbose than needed but will provide information pertaining to the root cause.

(cherry picked from commit 3b6a999)
  • Loading branch information
clydin authored and alan-agius4 committed Nov 3, 2023
1 parent c46f312 commit fa234a4
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -418,6 +418,9 @@ export function createCompilerPlugin(
}

build.onEnd((result) => {
// Ensure other compilations are unblocked if the main compilation throws during start
sharedTSCompilationState?.markAsReady();

for (const { outputFiles, metafile } of additionalResults.values()) {
// Add any additional output files to the main output files
if (outputFiles?.length) {
Expand Down

0 comments on commit fa234a4

Please sign in to comment.