New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS package build incorrectly includes dependencies of dependencies #9371
Comments
Hmmm, yes this was recently addressed for the rollup executor via #8640. It should be addressed here too. |
nx/packages/js/src/utils/check-dependencies.ts Lines 21 to 27 in 52b4765
The fix is a one liner: calculateProjectDependencies(
projectGraph,
context.root,
context.projectName,
context.targetName,
context.configurationName,
+ true
); |
Opened this recommended fix as PR #10600 |
I get the same result( |
Same issue on "15.0.0" |
Any news on this? |
This is still an issue , in latest Nx The mentioned fix for rollup (#8640) , does no longer work... Any workaround? |
@tinesoft there's an |
Hi @dmitry-stepanenko Unfortunately, doing so, will also prevent the rightful direct dependency (@nxrocks/common in my case)to be added... |
This is still a problem in Nx version 16 ... |
any chance of this ever getting fixed? it seems like a pretty big flaw in what I understand to be a core Nx feature |
Hi, to anyone interested, I'm managed to fix that issue by using @nx/dependency-checks ESLint rule to manage (almost) automatically the dependencies of your Nx library. You can follow this great article by my fellow Nx champion 🏆 @LayZeeDK --> https://dev.to/this-is-learning/manage-nx-library-dependencies-with-the-nxdependency-checks-eslint-rule-2lem for more information. For a real world project where this now recommended approach is implemented, you can have a look at my repo: https://github.com/tinesoft/nxrocks Hope it helps! ^^ |
@tinesoft wow, thank you so much for the recommendation! Thanks! |
I'm glad I could help 😊. FYI, @tefkah you kind of can automate this, by running the This command can be added as a npm script for example, and ran as a pre-commit hook, using a tool like Husky (git). |
Going to close this now since they just replaced the whole system with the linting rule (which has lots of its own problems I might add) |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
A package built with
@nrwl/js
which uses the "tsc" build executor will not output the correct dependencies in its resulting package.json file if the package depends on another buildable package in the repo which itself has dependencies. Instead, the package.json will include all the dependencies of that sub package as well.Expected Behavior
The resulting package.json should include only the dependencies it directly uses, not the dependencies of the other packages it depends on
Steps to Reproduce
nx build package-a
Environment
The text was updated successfully, but these errors were encountered: