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); + }); }); });