diff --git a/packages/nx/src/tasks-runner/create-task-graph.ts b/packages/nx/src/tasks-runner/create-task-graph.ts index 7ab3cd2fa6e7d..97572012dd4f8 100644 --- a/packages/nx/src/tasks-runner/create-task-graph.ts +++ b/packages/nx/src/tasks-runner/create-task-graph.ts @@ -388,10 +388,10 @@ export function createTaskGraph( } export function mapTargetDefaultsToDependencies( - defaults: TargetDefaults + defaults: TargetDefaults | undefined ): TargetDependencies { const res = {}; - Object.keys(defaults).forEach((k) => { + Object.keys(defaults ?? {}).forEach((k) => { res[k] = defaults[k].dependsOn; });