mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 23:15:56 +08:00
fix(@angular-devkit/build-angular): provide better error message when server option is required but missing
This improves the error message when the server entry-point is required but missing Closes #27251
This commit is contained in:
parent
a44b6c19c4
commit
1034bb155b
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user