Skip to content

Commit bf2e508

Browse files
SkyZeroZxAndrewKushnir
authored andcommitted
refactor(core): conditionally include debug names based on ngDevMode
Conditionally include debug-related metadata based on `ngDevMode` to avoid unnecessary information in production builds.
1 parent db5429f commit bf2e508

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/core/src/di/inject_switch.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ export function injectRootLimpMode<T>(
6060
}
6161
if (flags & InternalInjectFlags.Optional) return null;
6262
if (notFoundValue !== undefined) return notFoundValue;
63-
throwProviderNotFoundError(token, 'Injector');
63+
throwProviderNotFoundError(
64+
token,
65+
typeof ngDevMode !== 'undefined' && ngDevMode ? 'Injector' : '',
66+
);
6467
}
6568

6669
/**

packages/core/src/render3/standalone_service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export class StandaloneService implements OnDestroy {
3535
? createEnvironmentInjector(
3636
[providers],
3737
this._injector,
38-
`Standalone[${componentDef.type.name}]`,
38+
typeof ngDevMode !== 'undefined' && ngDevMode
39+
? `Standalone[${componentDef.type.name}]`
40+
: '',
3941
)
4042
: null;
4143
this.cachedInjectors.set(componentDef, standaloneInjector);

0 commit comments

Comments
 (0)