diff --git a/packages/nx/src/project-graph/utils/find-project-for-path.ts b/packages/nx/src/project-graph/utils/find-project-for-path.ts index 8ef705cc67e1b..6522b7be64f1c 100644 --- a/packages/nx/src/project-graph/utils/find-project-for-path.ts +++ b/packages/nx/src/project-graph/utils/find-project-for-path.ts @@ -1,6 +1,7 @@ import { dirname } from 'path'; import { ProjectGraphProjectNode } from '../../config/project-graph'; import { ProjectConfiguration } from '../../config/workspace-json-project-json'; +import { normalizePath } from '../../utils/path'; export type ProjectRootMappings = Map; @@ -44,7 +45,12 @@ export function findProjectForPath( filePath: string, projectRootMap: ProjectRootMappings ): string | null { - let currentPath = filePath; + /** + * Project Mappings are in UNIX-style file paths + * Windows may pass Win-style file paths + * Ensure filePath is in UNIX-style + */ + let currentPath = normalizePath(filePath); for ( ; currentPath != dirname(currentPath);