feat(compiler): mark @NgModules in provider lists for identification at runtime (#22005)
All of the providers in a module get compiled into a module definition in the factory file. Some of these providers are for the actual module types, as those are available for injection in Angular. For tree-shakeable tokens, the runtime needs to be able to distinguish which modules are present in an injector. This change adds a NodeFlag which tags those module providers for later identification. PR Close #22005
This commit is contained in:

committed by
Miško Hevery

parent
647b8595d0
commit
2d5e7d1b52
@ -29,6 +29,9 @@ export function providerDef(ctx: OutputContext, providerAst: ProviderAst): {
|
||||
if (providerAst.providerType === ProviderAstType.PrivateService) {
|
||||
flags |= NodeFlags.PrivateProvider;
|
||||
}
|
||||
if (providerAst.isModule) {
|
||||
flags |= NodeFlags.TypeModuleProvider;
|
||||
}
|
||||
providerAst.lifecycleHooks.forEach((lifecycleHook) => {
|
||||
// for regular providers, we only support ngOnDestroy
|
||||
if (lifecycleHook === LifecycleHooks.OnDestroy ||
|
||||
|
Reference in New Issue
Block a user