From 3ee861835a66e342f0df834b621b84cd22f9248c Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 25 Apr 2024 13:02:12 +0000 Subject: [PATCH] refactor(core): set up framework injector profile exclusively in browser environment (#55530) This commit modifies the setup of the injector profiler to occur solely when the application is running in a browser context. This adjustment is made because the injector profile serves no purpose when the application is running on the server. PR Close #55530 --- packages/core/src/render3/util/global_utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/src/render3/util/global_utils.ts b/packages/core/src/render3/util/global_utils.ts index 74093e3a752..e96704672b8 100644 --- a/packages/core/src/render3/util/global_utils.ts +++ b/packages/core/src/render3/util/global_utils.ts @@ -71,7 +71,11 @@ export function publishDefaultGlobalUtils() { if (!_published) { _published = true; - setupFrameworkInjectorProfiler(); + if (typeof window !== 'undefined') { + // Only configure the injector profiler when running in the browser. + setupFrameworkInjectorProfiler(); + } + for (const [methodName, method] of Object.entries(globalUtilsFunctions)) { publishGlobalUtil(methodName as GlobalUtilsFunctions, method); }