Skip to content
Permalink
Browse files

fix(ivy): auto register NgModules with ID (#33663)

PR Close #33663
  • Loading branch information
atscott authored and kara committed Nov 7, 2019
1 parent 9ab49de commit 4988094e7dff2c9879ca380dba7688ffc600851c
@@ -6,7 +6,9 @@
* found in the LICENSE file at https://angular.io/license
*/


import {Type} from '../interface/type';
import {autoRegisterModuleById} from '../render3/definition';
import {NgModuleType} from '../render3/ng_module_ref';
import {stringify} from '../util/stringify';

@@ -68,5 +70,5 @@ export function restoreRegisteredModulesState(moduleMap: ModuleRegistrationMap)
}

export function getRegisteredNgModuleType(id: string) {
return modules.get(id);
return modules.get(id) || autoRegisterModuleById[id];
}
@@ -22,6 +22,7 @@ import {TConstants} from './interfaces/node';
// while SelectorFlags is unused here, it's required so that types don't get resolved lazily
// see: https://github.com/Microsoft/web-build-tools/issues/1050
import {CssSelectorList, SelectorFlags} from './interfaces/projection';
import {NgModuleType} from './ng_module_ref';

let _renderCompCount = 0;

@@ -338,6 +339,8 @@ export function extractPipeDef(type: Type<any>): PipeDef<any> {
return def !;
}

export const autoRegisterModuleById: {[id: string]: NgModuleType} = {};

/**
* @codeGenApi
*/
@@ -376,6 +379,10 @@ export function ɵɵdefineNgModule<T>(def: {
schemas: def.schemas || null,
id: def.id || null,
};
if (def.id != null) {
noSideEffects(
() => { autoRegisterModuleById[def.id !] = def.type as unknown as NgModuleType; });
}
return res as never;
}

0 comments on commit 4988094

Please sign in to comment.
You can’t perform that action at this time.