Skip to content

findImports() excludes files based on .gitignore files outside of the repository #29413

@rene-leanix

Description

@rene-leanix

Current Behavior

The native findImports() (of nx-darwin-arm64 in my case) seems to include .gitignore-files outside of the repository from the parent folder when determining which files to exclude from the dependency computation. This can lead to incorrect project-dependencies and failing builds.

Expected Behavior

Only .gitignore-files within the current repository are taken into account and, of course, applied downstream.

GitHub Repo

https://github.com/rene-leanix/nx-20.2.2-dependency-bug

Steps to Reproduce

  1. Add a .gitignore file with the line classes to the parent folder of the example repository.
  2. Executing npm run build now fails.
  3. Executing npm run graph does not show any more that lib1 depends on lib2.

Nx Report

Node           : 18.19.1
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.2.4

nx                     : 20.2.2
@nx/js                 : 20.2.2
@nx/jest               : 20.2.2
@nx/eslint             : 20.2.2
@nx/workspace          : 20.2.2
@nx/angular            : 20.2.2
@nx/devkit             : 20.2.2
@nx/module-federation  : 20.2.2
@nx/plugin             : 20.2.2
@nx/web                : 20.2.2
@nx/webpack            : 20.2.2
typescript             : 5.6.3

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions