Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transitive npm devDependencies

We know how the dependencies work in NPM. My question is, how can I create a common-library that provides dev dependencies to multiple other components?

Let's say I have a microservice architecture where all the components use mocha and nyc for running the tests.

I don't want to go into each separate component to add them, but to manage this "testing framework" from one central library in devDependencies - however since they are not transitive, they are not installed. I cannot also put them in dependencies because they are not relevant in production mode...

Is it possible in NPM?

like image 807
warden Avatar asked Aug 05 '26 12:08

warden


1 Answers

I've Searched for the same but sadly, the response is :
no, this isn't possible in NPM.

Workaround

Adding them directly inside the peerDependencies list and counting on the three shaking to make it work.

Feature-request

https://github.com/npm/rfcs/issues/553

like image 104
Raphaël Balet Avatar answered Aug 07 '26 03:08

Raphaël Balet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!