Description
Current Behavior
#30111 and specifically the one line change here that removes sourceRoot
from the package-json plugins projectConfiguration response has resulted in all calls to createGlobPatternsForDependencies
from @nx/react/tailwind
failing with below log for us.
This is because createGlobPatternsForDependencies seems to require sourceRoot be set for all nodes as seen below. Without sourceRoot
, createGlobPatternsForDependencies will add all projects to the warning response and not generate globs for them.
Expected Behavior
Glob patterns are returned rather than an empty array.
GitHub Repo
No response
Steps to Reproduce
- Setup a package.json based repo.
- Call createGlobPatternsForDependencies.
- Observe no globs returned.
Nx Report
Node : 22.1.0
OS : darwin-arm64
Native Target : aarch64-macos
pnpm : 10.5.1
nx : 20.7.1
@nx/js : 20.7.1
@nx/eslint : 20.7.1
@nx/workspace : 20.7.1
@nx/devkit : 20.7.1
@nx/eslint-plugin : 20.7.1
@nx/module-federation : 20.7.1
@nx/react : 20.7.1
@nx/web : 20.7.1
typescript : 5.7.2
---------------------------------------
Nx key licensed packages
Licensed to _.
@nx/azure-cache : 1.3.1
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
---------------------------------------
Community plugins:
@nx/azure-cache : 1.3.1
---------------------------------------
Cache Usage: 543.89 KB / 92.64 GB
Failure Logs
[createGlobPatternsForDependencies] Failed to generate glob pattern for the following:
@company/package1
-@company/package2
due to missing "sourceRoot" in the dependencies' project configuration
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
Have fixed this temporarily by pnpm patching the sourceRoot
line back in to packages/nx/src/plugins/package-json/create-nodes.ts
.
const projectConfiguration: ProjectConfiguration & { name: string } = {
root: projectRoot,
+ sourceRoot: projectRoot,
name,