fix(ivy): register ModuleWithProviders when deduplicating imported modules (#27268)

PR Close #27268
This commit is contained in:
Olivier Combe
2018-11-21 13:40:27 +01:00
committed by Jason Aden
parent c2f30542e7
commit 32157115da
2 changed files with 19 additions and 23 deletions

View File

@ -227,9 +227,7 @@ export class R3Injector {
}
// Check for multiple imports of the same module
if (dedupStack.indexOf(defType) !== -1) {
return;
}
const isDuplicate = dedupStack.indexOf(defType) !== -1;
// If defOrWrappedType was an InjectorDefTypeWithProviders, then .providers may hold some
// extra providers.
@ -255,7 +253,7 @@ export class R3Injector {
// Add providers in the same way that @NgModule resolution did:
// First, include providers from any imports.
if (def.imports != null) {
if (def.imports != null && !isDuplicate) {
// Before processing defType's imports, add it to the set of parents. This way, if it ends
// up deeply importing itself, this can be detected.
ngDevMode && parents.push(defType);
@ -272,7 +270,7 @@ export class R3Injector {
}
// Next, include providers listed on the definition itself.
if (def.providers != null) {
if (def.providers != null && !isDuplicate) {
deepForEach(def.providers, provider => this.processProvider(provider));
}