mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-23 23:59:27 +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) {
|
if (options.server) {
|
||||||
serverEntryPoint = path.join(workspaceRoot, options.server);
|
serverEntryPoint = path.join(workspaceRoot, options.server);
|
||||||
} else if (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;
|
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
|
// Initial options to keep
|
||||||
const {
|
const {
|
||||||
allowedCommonJsDependencies,
|
allowedCommonJsDependencies,
|
||||||
|
@ -154,15 +154,8 @@ export function createServerCodeBundleOptions(
|
|||||||
target: string[],
|
target: string[],
|
||||||
sourceFileCache: SourceFileCache,
|
sourceFileCache: SourceFileCache,
|
||||||
): BuildOptions {
|
): BuildOptions {
|
||||||
const {
|
const { serverEntryPoint, workspaceRoot, ssrOptions, watch, externalPackages, prerenderOptions } =
|
||||||
jit,
|
options;
|
||||||
serverEntryPoint,
|
|
||||||
workspaceRoot,
|
|
||||||
ssrOptions,
|
|
||||||
watch,
|
|
||||||
externalPackages,
|
|
||||||
prerenderOptions,
|
|
||||||
} = options;
|
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
serverEntryPoint,
|
serverEntryPoint,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user