From dd1d69b2e2f89ddf793f80211e1fb2ffde9fb1e5 Mon Sep 17 00:00:00 2001 From: arturovt Date: Wed, 8 Jan 2025 16:14:44 +0200 Subject: [PATCH] refactor(common): drop `PRELOADED_IMAGES` name in production (#59425) In this commit, we drop the `PRELOADED_IMAGES` injection token name in production. PR Close #59425 --- .../src/directives/ng_optimized_image/tokens.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/common/src/directives/ng_optimized_image/tokens.ts b/packages/common/src/directives/ng_optimized_image/tokens.ts index 32348cc8ac1..1ccc422708a 100644 --- a/packages/common/src/directives/ng_optimized_image/tokens.ts +++ b/packages/common/src/directives/ng_optimized_image/tokens.ts @@ -23,7 +23,10 @@ export const DEFAULT_PRELOADED_IMAGES_LIMIT = 5; * This Set tracks the original src passed into the `ngSrc` input not the src after it has been * run through the specified `IMAGE_LOADER`. */ -export const PRELOADED_IMAGES = new InjectionToken>('NG_OPTIMIZED_PRELOADED_IMAGES', { - providedIn: 'root', - factory: () => new Set(), -}); +export const PRELOADED_IMAGES = new InjectionToken>( + typeof ngDevMode === 'undefined' || ngDevMode ? 'NG_OPTIMIZED_PRELOADED_IMAGES' : '', + { + providedIn: 'root', + factory: () => new Set(), + }, +);