diff --git a/packages/js/src/migrations/update-17-0-0/remove-deprecated-build-options.spec.ts b/packages/js/src/migrations/update-17-0-0/remove-deprecated-build-options.spec.ts index f5f0127ef8..b0def14c4b 100644 --- a/packages/js/src/migrations/update-17-0-0/remove-deprecated-build-options.spec.ts +++ b/packages/js/src/migrations/update-17-0-0/remove-deprecated-build-options.spec.ts @@ -53,6 +53,17 @@ describe('remove-deprecated-build-options', () => { await expect(migration(tree)).resolves.not.toThrow(); }); + it('should work if a target is an empty object', async () => { + addProjectConfiguration(tree, 'proj', { + root: 'proj', + targets: { + build: {}, + }, + }); + + await expect(migration(tree)).resolves.not.toThrow(); + }); + it('should not update community executors', async () => { addProjectConfiguration(tree, 'proj', { root: 'proj', diff --git a/packages/js/src/migrations/update-17-0-0/remove-deprecated-build-options.ts b/packages/js/src/migrations/update-17-0-0/remove-deprecated-build-options.ts index 46a2e3d3cf..7a834a1a9a 100644 --- a/packages/js/src/migrations/update-17-0-0/remove-deprecated-build-options.ts +++ b/packages/js/src/migrations/update-17-0-0/remove-deprecated-build-options.ts @@ -19,7 +19,8 @@ export default async function (tree: Tree) { for (const target of Object.values(projectConfig.targets)) { if ( - target.executor.startsWith('@nx/') && + target.executor?.startsWith('@nx/') && + target.options && ('buildableProjectDepsInPackageJsonType' in target.options || 'updateBuildableProjectDepsInPackageJson' in target.options) ) {