From f16de2fb0b92c06d9157b621035da9234c264120 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Fri, 10 Nov 2023 10:41:01 +0100 Subject: [PATCH] Angular: Handle nested module metadata --- .../src/client/angular-beta/utils/NgModulesAnalyzer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/frameworks/angular/src/client/angular-beta/utils/NgModulesAnalyzer.ts b/code/frameworks/angular/src/client/angular-beta/utils/NgModulesAnalyzer.ts index a63fdee1822b..bcf9386fb875 100644 --- a/code/frameworks/angular/src/client/angular-beta/utils/NgModulesAnalyzer.ts +++ b/code/frameworks/angular/src/client/angular-beta/utils/NgModulesAnalyzer.ts @@ -14,7 +14,7 @@ export const isComponentAlreadyDeclared = ( ): boolean => { if ( moduleDeclarations && - moduleDeclarations.some((declaration) => declaration === componentToFind) + moduleDeclarations.flat().some((declaration) => declaration === componentToFind) ) { // Found component in declarations array return true; @@ -23,7 +23,7 @@ export const isComponentAlreadyDeclared = ( return false; } - return moduleImports.some((importItem) => { + return moduleImports.flat().some((importItem) => { const extractedNgModuleMetadata = extractNgModuleMetadata(importItem); if (!extractedNgModuleMetadata) { // Not an NgModule