diff --git a/packages/angular_devkit/build_angular/src/utils/server-rendering/prerender.ts b/packages/angular_devkit/build_angular/src/utils/server-rendering/prerender.ts index d03d4821fd72..dc3eb7ecd4cc 100644 --- a/packages/angular_devkit/build_angular/src/utils/server-rendering/prerender.ts +++ b/packages/angular_devkit/build_angular/src/utils/server-rendering/prerender.ts @@ -37,7 +37,19 @@ export async function prerenderPages( warnings: string[]; errors: string[]; }> { + const output: Record = {}; + const warnings: string[] = []; + const errors: string[] = []; const allRoutes = await getAllRoutes(tsConfigPath, appShellOptions, prerenderOptions); + + if (allRoutes.size < 1) { + return { + errors, + warnings, + output, + }; + } + const outputFilesForWorker: Record = {}; for (const { text, path } of outputFiles) { @@ -65,10 +77,6 @@ export async function prerenderPages( ], }); - const output: Record = {}; - const warnings: string[] = []; - const errors: string[] = []; - try { const renderingPromises: Promise[] = [];