diff --git a/packages/angular_devkit/build_angular/src/builders/application/options.ts b/packages/angular_devkit/build_angular/src/builders/application/options.ts index fe9c45258c4e..36c95b3622ac 100644 --- a/packages/angular_devkit/build_angular/src/builders/application/options.ts +++ b/packages/angular_devkit/build_angular/src/builders/application/options.ts @@ -221,7 +221,7 @@ export async function normalizeOptions( if (options.server) { serverEntryPoint = path.join(workspaceRoot, options.server); } else if (options.server === '') { - throw new Error('`server` option cannot be an empty string.'); + throw new Error('The "server" option cannot be an empty string.'); } let prerenderOptions; @@ -253,6 +253,12 @@ export async function normalizeOptions( }; } + if ((appShellOptions || ssrOptions || prerenderOptions) && !serverEntryPoint) { + throw new Error( + 'The "server" option is required when enabling "ssr", "prerender" or "app-shell".', + ); + } + // Initial options to keep const { allowedCommonJsDependencies, diff --git a/packages/angular_devkit/build_angular/src/tools/esbuild/application-code-bundle.ts b/packages/angular_devkit/build_angular/src/tools/esbuild/application-code-bundle.ts index 04bc801b5df4..a107cd16b38b 100644 --- a/packages/angular_devkit/build_angular/src/tools/esbuild/application-code-bundle.ts +++ b/packages/angular_devkit/build_angular/src/tools/esbuild/application-code-bundle.ts @@ -154,15 +154,8 @@ export function createServerCodeBundleOptions( target: string[], sourceFileCache: SourceFileCache, ): BuildOptions { - const { - jit, - serverEntryPoint, - workspaceRoot, - ssrOptions, - watch, - externalPackages, - prerenderOptions, - } = options; + const { serverEntryPoint, workspaceRoot, ssrOptions, watch, externalPackages, prerenderOptions } = + options; assert( serverEntryPoint,