Skip to content

Commit 6af2557

Browse files
committed
fix(core): normalize ./ prefix in workspace globs for package detection
Strip leading ./ from packageConfigs globs before matching against Nx project roots, which are always normalized without the prefix. This fixes workspace detection when package.json uses "./packages/*" style globs, which are valid in both npm and yarn. Closes #4190
1 parent 2d1c878 commit 6af2557

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

libs/core/src/lib/command/create-project-graph-with-packages.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ export async function createProjectGraphWithPackages(
2121
// We respect the NX_WORKSPACE_ROOT_PATH environment variable at runtime in order to support existing unit tests
2222
const _workspaceRoot = process.env["NX_WORKSPACE_ROOT_PATH"] || workspaceRoot;
2323

24+
const normalizedPackageConfigs = packageConfigs.map((config) => config.replace(/^\.\//, ""));
2425
const projectNodes = Object.values(projectGraph.nodes);
2526
const projectNodesMatchingPackageConfigs = projectNodes.filter((node) => {
2627
const matchesRootPath = (config: string) => minimatch(node.data.root, config);
27-
return packageConfigs.some(matchesRootPath);
28+
return normalizedPackageConfigs.some(matchesRootPath);
2829
});
2930
const tuples = await Promise.all(
3031
projectNodesMatchingPackageConfigs.map(

0 commit comments

Comments
 (0)