From 8ba10f6f8558f49efaec5a190983dd19699f1c0a Mon Sep 17 00:00:00 2001 From: Isaac Mann Date: Fri, 2 Feb 2024 10:20:44 -0500 Subject: [PATCH] fix(core): module federation migration for project with no targets --- .../update-18-0-0/add-mf-env-var-to-target-defaults.ts | 2 +- .../update-18-0-0/add-mf-env-var-to-target-defaults.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/angular/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.ts b/packages/angular/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.ts index 14cc7c7a25d7c..51aaf3e7c209b 100644 --- a/packages/angular/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.ts +++ b/packages/angular/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.ts @@ -19,7 +19,7 @@ export default async function (tree: Tree) { function isWebpackBrowserUsed(tree: Tree) { const projects = getProjects(tree); for (const project of projects.values()) { - const targets = project.targets; + const targets = project.targets || {}; for (const [_, target] of Object.entries(targets)) { if ( target.executor === '@nx/angular:webpack-browser' && diff --git a/packages/react/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.ts b/packages/react/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.ts index 0e40ca3de0bc6..076a7170e0b93 100644 --- a/packages/react/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.ts +++ b/packages/react/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.ts @@ -19,7 +19,7 @@ export default async function (tree: Tree) { function hasModuleFederationProject(tree: Tree) { const projects = getProjects(tree); for (const project of projects.values()) { - const targets = project.targets; + const targets = project.targets || {}; for (const [_, target] of Object.entries(targets)) { if ( target.executor === '@nx/webpack:webpack' &&