From 926bd1415de7d69b0c7e57ebabf01ea4f799fae1 Mon Sep 17 00:00:00 2001 From: Colum Ferry Date: Tue, 20 Jun 2023 12:20:41 +0100 Subject: [PATCH] fix(core): windows filePaths should be handled in findProjectForPath --- .../nx/src/project-graph/utils/find-project-for-path.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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);