mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 18:13:38 +08:00
fix(@angular/build): add warning when --prerendering
or --app-shell
are no-ops
Both options are ineffective when used with `outputMode`, so a warning is now issued.
This commit is contained in:
parent
43cd4584f5
commit
137e8e0ceb
@ -220,17 +220,17 @@ export async function normalizeOptions(
|
||||
options.ssr = false;
|
||||
}
|
||||
|
||||
if (options.prerender) {
|
||||
if (options.prerender !== undefined) {
|
||||
context.logger.warn(
|
||||
'The "prerender" option is no longer needed when "outputMode" is specified.',
|
||||
'The "prerender" option is not considered when "outputMode" is specified.',
|
||||
);
|
||||
} else {
|
||||
options.prerender = !!options.server;
|
||||
}
|
||||
|
||||
if (options.appShell) {
|
||||
options.prerender = !!options.server;
|
||||
|
||||
if (options.appShell !== undefined) {
|
||||
context.logger.warn(
|
||||
'The "appShell" option is no longer needed when "outputMode" is specified.',
|
||||
'The "appShell" option is not considered when "outputMode" is specified.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -536,7 +536,6 @@
|
||||
},
|
||||
"prerender": {
|
||||
"description": "Prerender (SSG) pages of your application during build time.",
|
||||
"default": false,
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "boolean",
|
||||
@ -586,8 +585,7 @@
|
||||
},
|
||||
"appShell": {
|
||||
"type": "boolean",
|
||||
"description": "Generates an application shell during build time.",
|
||||
"default": false
|
||||
"description": "Generates an application shell during build time."
|
||||
},
|
||||
"outputMode": {
|
||||
"type": "string",
|
||||
|
@ -102,7 +102,7 @@ export async function* serveWithVite(
|
||||
if (browserOptions.prerender || (browserOptions.outputMode && browserOptions.server)) {
|
||||
// Disable prerendering if enabled and force SSR.
|
||||
// This is so instead of prerendering all the routes for every change, the page is "prerendered" when it is requested.
|
||||
browserOptions.prerender = false;
|
||||
browserOptions.prerender = undefined;
|
||||
browserOptions.ssr ||= true;
|
||||
}
|
||||
|
||||
|
@ -53,8 +53,9 @@ export async function extractMessages(
|
||||
buildOptions.serviceWorker = false;
|
||||
buildOptions.server = undefined;
|
||||
buildOptions.ssr = false;
|
||||
buildOptions.appShell = false;
|
||||
buildOptions.prerender = false;
|
||||
buildOptions.appShell = undefined;
|
||||
buildOptions.prerender = undefined;
|
||||
buildOptions.outputMode = undefined;
|
||||
|
||||
const builderResult = await first(buildApplicationInternal(buildOptions, context));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user