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