From ff3b3a717c3655881e3859045babac983344a928 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Wed, 20 Apr 2022 14:59:30 -0400 Subject: [PATCH] fix(react): update migrations to work for projects without targets (#9906) --- .../update-14-0-0/replace-testing-library-react-hook.ts | 2 +- .../migrations/update-14-0-0/update-react-dom-render-for-v18.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/src/migrations/update-14-0-0/replace-testing-library-react-hook.ts b/packages/react/src/migrations/update-14-0-0/replace-testing-library-react-hook.ts index 1b75b686d9f9b..fb269111db689 100644 --- a/packages/react/src/migrations/update-14-0-0/replace-testing-library-react-hook.ts +++ b/packages/react/src/migrations/update-14-0-0/replace-testing-library-react-hook.ts @@ -8,7 +8,7 @@ import { export async function update(tree: Tree) { const projects = getProjects(tree); projects.forEach((config) => { - if (config.targets.test?.executor !== '@nrwl/jest:jest') return; + if (config.targets?.test?.executor !== '@nrwl/jest:jest') return; visitNotIgnoredFiles(tree, config.sourceRoot, (file) => { if (!file.endsWith('.spec.ts')) return; diff --git a/packages/react/src/migrations/update-14-0-0/update-react-dom-render-for-v18.ts b/packages/react/src/migrations/update-14-0-0/update-react-dom-render-for-v18.ts index bd4c1da8591c9..e8ced25914ec0 100644 --- a/packages/react/src/migrations/update-14-0-0/update-react-dom-render-for-v18.ts +++ b/packages/react/src/migrations/update-14-0-0/update-react-dom-render-for-v18.ts @@ -15,7 +15,7 @@ export async function update(tree: Tree) { projects.forEach((config, name) => { const isReactProject = - config.targets.build?.executor === '@nrwl/web:webpack' && + config.targets?.build?.executor === '@nrwl/web:webpack' && /main\.(t|j)sx?$/.test(config.targets.build.options.main); if (isReactProject) {