JS package build incorrectly includes dependencies of dependencies
See original GitHub issueCurrent 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
- Generate buildable JS packages A and B
- Add some dependency to package B (say lodash)
- Add package B as a dependency of package A
nx build package-a
- Package A will include lodash in its package.json even if its only directly used by package B
Environment
> NX Report complete - copy this into the issue template
Node : 16.13.2
OS : darwin x64
npm : 8.1.2
nx : 13.8.8
@nrwl/angular : undefined
@nrwl/cli : 13.8.8
@nrwl/cypress : 13.8.5
@nrwl/detox : undefined
@nrwl/devkit : 13.8.8
@nrwl/eslint-plugin-nx : 13.8.8
@nrwl/express : undefined
@nrwl/jest : 13.8.8
@nrwl/js : 13.8.8
@nrwl/linter : 13.8.8
@nrwl/nest : undefined
@nrwl/next : 13.8.5
@nrwl/node : 13.8.8
@nrwl/nx-cloud : undefined
@nrwl/react : 13.8.8
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : 13.8.8
@nrwl/tao : 13.8.8
@nrwl/web : 13.8.8
@nrwl/workspace : 13.8.8
typescript : 4.3.5
rxjs : 6.6.7
---------------------------------------
Community plugins:
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
NPM Dependency errors? Then You're doing it wrong. - Medium
The Problem with non-deterministic dependencies. You set up a new Node JS/Webpack project, installed all your dependencies with npm install and your app...
Read more >Javascript: is package.json dependency included in build, if ...
The package.json and the dev-dependencies are primarily about your module being installed by others, when you do not distribute a bundled ...
Read more >dealing with problematic dependencies in a restricted network ...
This is when a package dependency is listed in a package.json file with a reference to a Git repository instead of with a...
Read more >Ride Down Into JavaScript Dependency Hell - AppSignal Blog
Find out how a single JS package can come with 19k dependencies. ... Let's say you want to build a blog and you...
Read more >How to Solve the Global npm Module Dependency Problem
The Node Package Manager (a.k.a. npm) has given web developers easy access to a lot of awesome JavaScript modules and has made our...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same issue on “15.0.0”
Opened this recommended fix as PR #10600