-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Manually adding a devDependency to a package.json file no longer excludes it from dependencies
#17758
Comments
Did a little digging and I think the problem was introduced in this PR when the js executor stopped using the You can still see the old codepath for removing the devDependencies present here:
|
I understand that the current approach may not be ideal, and I appreciate your feedback. Rest assured, we are actively working on enhancing the handling of package.json to make it more robust and flexible to accommodate various use cases. In the meantime, I'm glad that you found a workaround. It serves as a temporary solution until we implement the improvements. I will keep this issue open so that we can refer back to it during our ongoing discussions and development process. Feel free to reach out if you have any further questions or concerns. |
@ndcunningham appreciate the response I'm glad to hear you're making improvements in the area, but would it also not be possible to get in a quick fix to restore this behaviour in the meantime? It's technically a breaking change that I believe was introduced accidentally, and my "workaround" is basically to apply a patch to the js package that fixes the bug. I know it's maybe a slightly niche behaviour, but for us it's basically a "we can no longer use Nx unmodified to publish our packages" type of issue. |
@ndcunningham It's indeed a breaking changes for publish libraries for latest nx(v16.4.3). Hope It could be fixed asap. That PR @ajwootto mentioned was introduced long time ago. We can not rollback to an older version to bypass the problem. |
YMMV but it setting "targets": {
"build": {
"executor": "@nx/rollup:rollup",
"options": {
...
"external": "all", |
FYI until this is fixed you can try applying the fix I have in this PR: using something like It also means you'll be stuck at that version of Nx (like we are) unless you want to keep applying the patch post-update. For us we just aren't going to update Nx again until this is fixed. |
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
In previous versions of Nx, adding a
devDependencies
entry for another package in your repo (say something only used by tests) would tell Nx to not add it to the "dependencies" section of the generated package.json for that package.Now it appears in both "dependencies" and "devDependencies". This breaks the ability to correctly publish packages with Nx.
Expected Behavior
It should work the same as before
This issue is compounded by the fact that most of the Nx build executors are still adding dependencies of dependencies to the output package.json
Here is a helpful list of all the related issues compiled by @JosefBredereck
#10227 (comment)
GitHub Repo
https://github.com/devcyclehq/js-sdks
Steps to Reproduce
nx build nodejs
@devcycle/bucketing-test-data
in the "dependencies" section of package.json as well asdevDependencies
. It should only be listed indevDependencies
Nx Report
Failure Logs
No response
Operating System
Additional Information
this is mission-critical behaviour of Nx IMO, it has caused an incident on our side due to publishing packages that cannot be installed by end-users.
The text was updated successfully, but these errors were encountered: