fix(ivy): componentFactories not populated in ModuleWithComponentFactories (#28112)
Fixes the `ModuleWithComponentFactories.componentFactories` not being populated when calling `compileModuleAndAllComponentsSync` in Ivy. These changes resolve FW-929. PR Close #28112
This commit is contained in:

committed by
Andrew Kushnir

parent
da1d19b40f
commit
bac71ef419
@ -12,6 +12,8 @@ import {StaticProvider} from '../di/interface/provider';
|
||||
import {MissingTranslationStrategy} from '../i18n/tokens';
|
||||
import {Type} from '../interface/type';
|
||||
import {ViewEncapsulation} from '../metadata';
|
||||
import {ComponentFactory as ComponentFactoryR3} from '../render3/component_ref';
|
||||
import {getComponentDef, getNgModuleDef} from '../render3/definition';
|
||||
import {NgModuleFactory as NgModuleFactoryR3} from '../render3/ng_module_ref';
|
||||
|
||||
import {ComponentFactory} from './component_factory';
|
||||
@ -56,7 +58,14 @@ const Compiler_compileModuleAndAllComponentsSync__PRE_R3__: <T>(moduleType: Type
|
||||
export const Compiler_compileModuleAndAllComponentsSync__POST_R3__: <T>(moduleType: Type<T>) =>
|
||||
ModuleWithComponentFactories<T> = function<T>(moduleType: Type<T>):
|
||||
ModuleWithComponentFactories<T> {
|
||||
return new ModuleWithComponentFactories(Compiler_compileModuleSync__POST_R3__(moduleType), []);
|
||||
const ngModuleFactory = Compiler_compileModuleSync__POST_R3__(moduleType);
|
||||
const moduleDef = getNgModuleDef(moduleType) !;
|
||||
const componentFactories = moduleDef.declarations.reduce((factories, declaration) => {
|
||||
const componentDef = getComponentDef(declaration);
|
||||
componentDef && factories.push(new ComponentFactoryR3(componentDef));
|
||||
return factories;
|
||||
}, [] as ComponentFactory<any>[]);
|
||||
return new ModuleWithComponentFactories(ngModuleFactory, componentFactories);
|
||||
};
|
||||
const Compiler_compileModuleAndAllComponentsSync =
|
||||
Compiler_compileModuleAndAllComponentsSync__PRE_R3__;
|
||||
|
Reference in New Issue
Block a user