Skip to content

Commit c8c9853

Browse files
committed
Don't consider a subpackage as the workspace root
A leaf package may have a workspaces property (e.g. for nohoist). Prevent from considering that package to be a workspace root.
1 parent 4b7c4fb commit c8c9853

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react-scripts/config/yarn-workspaces.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ const getWorkspacesRootConfig = dir => {
2323

2424
const packageObj = loadPackageJson(packageJsonUp);
2525

26-
if (Reflect.has(packageObj, 'workspaces')) {
26+
if (
27+
packageObj.workspaces &&
28+
(
29+
Array.isArray(packageObj.workspaces) ||
30+
Reflect.has(packageObj.workspaces, 'packages')
31+
)
32+
) {
2733
const workspacesRootConfig = {
2834
root: path.dirname(packageJsonUp),
2935
workspaces: packageObj.workspaces

0 commit comments

Comments
 (0)