Sunday, 2 December 2018

Understanding npm-link behaviour

Let's say I have two projects, A and B. B lists A as a dependency. Now when B lists A as a dependency and I use npm install, the required dependencies of A would be downloaded into B’s node_modules folder. A depends on lodash, so now that B has lodash installed in node_modules, I could use lodash without specifying it in B's package.json.I want to make changes to A and test those changes in B before publishing A to the world.So I can link project A to project B using npm-link.So when I npm link B to A, how does A’s dependencies get resolved for B?If module A depends on lodash, is it bad practice to then use lodash in B but not declare it specifically in the dependencies, but expect that it will be available from requiring A?

Submitted December 02, 2018 at 09:14PM by CutleryHero

No comments:

Post a Comment