Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): avoid spawning workers when there…
Browse files Browse the repository at this point in the history
… are no routes to prerender

This commit fixes an issue were previously we spawned piscina with `maxThreads` set to `0` which causes it to exit with a non zero error code when there are no routes to prerender.

Now, in the application builder we exit at n earlier stage if there are no routes to prerender.
  • Loading branch information
alan-agius4 committed Sep 13, 2023
1 parent d2f4750 commit e41e201
Showing 1 changed file with 12 additions and 4 deletions.
Expand Up @@ -37,7 +37,19 @@ export async function prerenderPages(
warnings: string[];
errors: string[];
}> {
const output: Record<string, string> = {};
const warnings: string[] = [];
const errors: string[] = [];
const allRoutes = await getAllRoutes(tsConfigPath, appShellOptions, prerenderOptions);

if (allRoutes.size < 1) {
return {
errors,
warnings,
output,
};
}

const outputFilesForWorker: Record<string, string> = {};

for (const { text, path } of outputFiles) {
Expand Down Expand Up @@ -65,10 +77,6 @@ export async function prerenderPages(
],
});

const output: Record<string, string> = {};
const warnings: string[] = [];
const errors: string[] = [];

try {
const renderingPromises: Promise<void>[] = [];

Expand Down

0 comments on commit e41e201

Please sign in to comment.