From 1fda800b332af491e14f2d5d213d63af952405aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Jona=C5=A1?= Date: Sun, 18 Jun 2023 13:58:08 +0200 Subject: [PATCH] fix(core): ignore nested node_module paths for findProjectOfResolvedModule in TargetProjectLocator (#17630) --- .../build-dependencies/target-project-locator.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/nx/src/plugins/js/project-graph/build-dependencies/target-project-locator.ts b/packages/nx/src/plugins/js/project-graph/build-dependencies/target-project-locator.ts index cab279a55b745..b12b0808c5a6a 100644 --- a/packages/nx/src/plugins/js/project-graph/build-dependencies/target-project-locator.ts +++ b/packages/nx/src/plugins/js/project-graph/build-dependencies/target-project-locator.ts @@ -181,7 +181,12 @@ export class TargetProjectLocator { private findProjectOfResolvedModule( resolvedModule: string ): string | undefined { - if (resolvedModule.startsWith('node_modules/')) return undefined; + if ( + resolvedModule.startsWith('node_modules/') || + resolvedModule.includes('/node_modules/') + ) { + return undefined; + } const normalizedResolvedModule = resolvedModule.startsWith('./') ? resolvedModule.substring(2) : resolvedModule;