Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function executePostBundleSteps(
prerenderOptions,
appShellOptions,
workspaceRoot,
disableFullServerManifestGeneration,
partialSSRBuild,
} = options;

// Index HTML content without CSS inlining to be used for server rendering (AppShell, SSG and SSR).
Expand Down Expand Up @@ -125,7 +125,7 @@ export async function executePostBundleSteps(
// Pre-render (SSG) and App-shell
// If localization is enabled, prerendering is handled in the inlining process.
if (
!disableFullServerManifestGeneration &&
!partialSSRBuild &&
(prerenderOptions || appShellOptions || (outputMode && serverEntryPoint)) &&
!allErrors.length
) {
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/build/src/builders/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ export async function* buildApplicationInternal(

yield* runEsBuildBuildAction(
async (rebuildState) => {
const { serverEntryPoint, jsonLogs, disableFullServerManifestGeneration } = normalizedOptions;
const { serverEntryPoint, jsonLogs, partialSSRBuild } = normalizedOptions;

const startTime = process.hrtime.bigint();
const result = await executeBuild(normalizedOptions, context, rebuildState);

if (jsonLogs) {
result.addLog(await createJsonBuildManifest(result, normalizedOptions));
} else {
if (serverEntryPoint && !disableFullServerManifestGeneration) {
if (serverEntryPoint && !partialSSRBuild) {
const prerenderedRoutesLength = Object.keys(result.prerenderedRoutes).length;
let prerenderMsg = `Prerendered ${prerenderedRoutesLength} static route`;
prerenderMsg += prerenderedRoutesLength !== 1 ? 's.' : '.';
Expand Down
14 changes: 6 additions & 8 deletions packages/angular/build/src/builders/application/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { createRequire } from 'node:module';
import path from 'node:path';
import { normalizeAssetPatterns, normalizeOptimization, normalizeSourceMaps } from '../../utils';
import { supportColor } from '../../utils/color';
import { useJSONBuildLogs } from '../../utils/environment-options';
import { useJSONBuildLogs, usePartialSsrBuild } from '../../utils/environment-options';
import { I18nOptions, createI18nOptions } from '../../utils/i18n-options';
import { IndexHtmlTransform } from '../../utils/index-file/index-html-generator';
import { normalizeCacheOptions } from '../../utils/normalize-cache';
Expand Down Expand Up @@ -82,14 +82,12 @@ interface InternalOptions {
forceI18nFlatOutput?: boolean;

/**
* When set to `true`, disables the generation of a full manifest with routes.
*
* This option is primarily used during development to improve performance,
* as the full manifest is generated at runtime when using the development server.
* When set to `true`, enables fast SSR in development mode by disabling the full manifest generation and prerendering.
*
* This option is intended to optimize performance during development by skipping prerendering and route extraction when not required.
* @default false
*/
disableFullServerManifestGeneration?: boolean;
partialSSRBuild?: boolean;

/**
* Enables the use of AOT compiler emitted external runtime styles.
Expand Down Expand Up @@ -382,7 +380,7 @@ export async function normalizeOptions(
deployUrl,
clearScreen,
define,
disableFullServerManifestGeneration = false,
partialSSRBuild = false,
externalRuntimeStyles,
} = options;

Expand Down Expand Up @@ -444,7 +442,7 @@ export async function normalizeOptions(
colors: supportColor(),
clearScreen,
define,
disableFullServerManifestGeneration,
partialSSRBuild: usePartialSsrBuild || partialSSRBuild,
externalRuntimeStyles,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export async function* serveWithVite(

// Disable generating a full manifest with routes.
// This is done during runtime when using the dev-server.
browserOptions.disableFullServerManifestGeneration = true;
browserOptions.partialSSRBuild = true;

// The development server currently only supports a single locale when localizing.
// This matches the behavior of the Webpack-based development server but could be expanded in the future.
Expand Down
4 changes: 4 additions & 0 deletions packages/angular/build/src/utils/environment-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,7 @@ export const shouldOptimizeChunks =
const hmrComponentStylesVariable = process.env['NG_HMR_CSTYLES'];
export const useComponentStyleHmr =
isPresent(hmrComponentStylesVariable) && isEnabled(hmrComponentStylesVariable);

const partialSsrBuildVariable = process.env['NG_BUILD_PARTIAL_SSR'];
export const usePartialSsrBuild =
isPresent(partialSsrBuildVariable) && isEnabled(partialSsrBuildVariable);