From 11ab5db9bda59d6f94c4208ed38eb58db435211e Mon Sep 17 00:00:00 2001 From: arturovt Date: Mon, 24 Feb 2025 19:44:02 +0200 Subject: [PATCH] refactor(core): inline `depPath` in `throwCyclicDependencyError` to be dropped (#60084) Inlines the `depPath` within the `throwCyclicDependencyError`, because it's not being tree-shaken in production. PR Close #60084 --- packages/core/src/render3/errors_di.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/render3/errors_di.ts b/packages/core/src/render3/errors_di.ts index 0762a4fff76..866dd2e6f3c 100644 --- a/packages/core/src/render3/errors_di.ts +++ b/packages/core/src/render3/errors_di.ts @@ -16,10 +16,11 @@ import {stringifyForError} from './util/stringify_utils'; /** Called when directives inject each other (creating a circular dependency) */ export function throwCyclicDependencyError(token: string, path?: string[]): never { - const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : ''; throw new RuntimeError( RuntimeErrorCode.CYCLIC_DI_DEPENDENCY, - ngDevMode ? `Circular dependency in DI detected for ${token}${depPath}` : token, + ngDevMode + ? `Circular dependency in DI detected for ${token}${path ? `. Dependency path: ${path.join(' > ')} > ${token}` : ''}` + : token, ); }