question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JS package build incorrectly includes dependencies of dependencies

See original GitHub issue

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

  1. Generate buildable JS packages A and B
  2. Add some dependency to package B (say lodash)
  3. Add package B as a dependency of package A
  4. nx build package-a
  5. 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:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
npworkcommented, Oct 19, 2022

Same issue on “15.0.0”

1reaction
mckramercommented, Jun 6, 2022

Opened this recommended fix as PR #10600

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found