From 321fb3299c6b928ff3d2605945d4884bf95eaa59 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:10:17 -0500 Subject: [PATCH] fix(@angular/build): fully disable component style HMR in JIT mode The component stylesheet HMR functionality requires build-time analysis of each component by the AOT compiler to provide the needed information to identify initial styles and detect individual changes to each style. Part of the style HMR rebuild logic was unintentionally enabled in JIT mode. The initial load of the application operated correctly but subsequent changes to file-based stylesheets were delayed by one rebuild cycle. To avoid this misalignment, all component stylesheet HMR functionality is now disabled when in JIT mode. --- packages/angular/build/src/builders/application/options.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/angular/build/src/builders/application/options.ts b/packages/angular/build/src/builders/application/options.ts index 39e75ef7ca4d..9c488e327a98 100644 --- a/packages/angular/build/src/builders/application/options.ts +++ b/packages/angular/build/src/builders/application/options.ts @@ -381,7 +381,7 @@ export async function normalizeOptions( // Initial options to keep const { allowedCommonJsDependencies, - aot, + aot = true, baseHref, crossOrigin, externalDependencies, @@ -469,7 +469,7 @@ export async function normalizeOptions( clearScreen, define, partialSSRBuild: usePartialSsrBuild || partialSSRBuild, - externalRuntimeStyles, + externalRuntimeStyles: aot && externalRuntimeStyles, instrumentForCoverage, security, templateUpdates: !!options.templateUpdates,