From bb89fc51c02fbcd6cdf10204a977bb641d0589fa Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Mon, 21 Sep 2026 11:40:15 -0400 Subject: [PATCH] fix(@angular/build): include dataurl option in global stylesheet config hash The global stylesheet configuration hash did not include the 'dataurl' option from 'BundleStylesheetOptions'. When persistent stylesheet caching is enabled, toggling or changing the 'dataurl' option should invalidate cached stylesheet bundles. --- .../esbuild/stylesheets/stylesheet-cache-key.ts | 2 ++ .../stylesheets/stylesheet-cache-key_spec.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-cache-key.ts b/packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-cache-key.ts index 22397ab189b3..d760a14197ec 100644 --- a/packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-cache-key.ts +++ b/packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-cache-key.ts @@ -26,6 +26,7 @@ import type { BundleStylesheetOptions } from './bundle-options'; * - `publicPath`: Affects relative asset URL rewriting (`url('...')`) inside CSS output. * - `outputNames`: Affects asset output filename hashing schemes. * - `inlineFonts`: Controls whether external web font `@import` / `` directives are inlined. + * - `dataurl`: Controls whether referenced assets are inlined as base64 data URIs. * - `preserveSymlinks`: Controls symlink realpath resolution in monorepos/pnpm workspace packages. * - `externalDependencies`: Controls which CSS modules/urls are excluded from bundling. * - `postcssConfig`: Path to custom PostCSS configuration file. @@ -56,6 +57,7 @@ export function calculateGlobalStylesheetConfigHash( publicPath: options.publicPath, outputNames: options.outputNames, inlineFonts: options.inlineFonts, + dataurl: options.dataurl ?? false, preserveSymlinks: options.preserveSymlinks, externalDependencies: options.externalDependencies, postcssConfig: options.postcssConfiguration?.configPath diff --git a/packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-cache-key_spec.ts b/packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-cache-key_spec.ts index c524a2d0c36b..49b232720fbf 100644 --- a/packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-cache-key_spec.ts +++ b/packages/angular/build/src/tools/esbuild/stylesheets/stylesheet-cache-key_spec.ts @@ -70,5 +70,20 @@ describe('Stylesheet Global Config Hash', () => { ); expect(hash1).not.toBe(hash2); }); + + it('should produce different hashes when dataurl changes', () => { + const hash1 = calculateGlobalStylesheetConfigHash(baseOptions, '1.0.0'); + const hash2 = calculateGlobalStylesheetConfigHash({ ...baseOptions, dataurl: true }, '1.0.0'); + expect(hash1).not.toBe(hash2); + }); + + it('should produce the same hash when dataurl is undefined or false', () => { + const hash1 = calculateGlobalStylesheetConfigHash(baseOptions, '1.0.0'); + const hash2 = calculateGlobalStylesheetConfigHash( + { ...baseOptions, dataurl: false }, + '1.0.0', + ); + expect(hash1).toBe(hash2); + }); }); });