'Sharing dependencies and their versions across a large number of npm packages
We have a large number of npm packages, namely package-A ... package-Z, which are independent packages (ie. which are not packages within the same monorepo).
All these packages have a set of common dependencies and devDependencies of the same versions. Currently those dependencies are explicitly declared in the package.json file of all the packages.
As you can see, dependency management for these packages is a nightmare:
- updating the version of a specific common dependency requires changes to all of their package.json
- adding a new dependency also requires changes to all the their package.json
In order to ease out the painful dependency management, I attempted to create a single package which has all the common dependencies bundled (ie. having the common dependencies declared in the bundledDependencies), and then have those package-A ... package-Z depend on the new package.
However, this approach is proved to be not working as asked and self-answered in another recently raised question: Npm bundled dependencies not working as expected.
Is there a better way to handle the dependency management across different packages?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
