feat(ivy): exclude declarations from injector imports (#29598)
Prior to this change, a module's imports and exports would be used verbatim as an injectors' imports. This is detrimental for tree-shaking, as a module's exports could reference declarations that would then prevent such declarations from being eligible for tree-shaking. Since an injector actually only needs NgModule references as its imports, we may safely filter out any declarations from the list of module exports. This makes them eligible for tree-shaking once again. PR Close #29598
This commit is contained in:
@ -191,7 +191,7 @@ export interface R3InjectorMetadata {
|
||||
type: o.Expression;
|
||||
deps: R3DependencyMetadata[]|null;
|
||||
providers: o.Expression;
|
||||
imports: o.Expression;
|
||||
imports: o.Expression[];
|
||||
}
|
||||
|
||||
export function compileInjector(meta: R3InjectorMetadata): R3InjectorDef {
|
||||
@ -204,7 +204,7 @@ export function compileInjector(meta: R3InjectorMetadata): R3InjectorDef {
|
||||
const expression = o.importExpr(R3.defineInjector).callFn([mapToMapExpression({
|
||||
factory: result.factory,
|
||||
providers: meta.providers,
|
||||
imports: meta.imports,
|
||||
imports: o.literalArr(meta.imports),
|
||||
})]);
|
||||
const type =
|
||||
new o.ExpressionType(o.importExpr(R3.InjectorDef, [new o.ExpressionType(meta.type)]));
|
||||
|
Reference in New Issue
Block a user