diff --git a/packages/devkit/src/generators/visit-not-ignored-files.ts b/packages/devkit/src/generators/visit-not-ignored-files.ts index e154dee2b8c35..87a6ea0b7ebce 100644 --- a/packages/devkit/src/generators/visit-not-ignored-files.ts +++ b/packages/devkit/src/generators/visit-not-ignored-files.ts @@ -18,6 +18,7 @@ export function visitNotIgnoredFiles( ig.add(tree.read('.gitignore', 'utf-8')); } if (tree.exists('.nxignore')) { + ig ??= ignore(); ig.add(tree.read('.nxignore', 'utf-8')); } dirPath = normalizePathRelativeToRoot(dirPath, tree.root);