DevDependency vs Dependency, npm.

Not a big deal at all, just curious, but I come across this all the time: Packages that I feel should be dev dependencies but aren't. The latest is Mocha, but like I said it feels pretty frequent. Does it not really matter that much? I don't really know enough to comment, so maybe I'm just way off base 🙂
8 Replies
ErickO
ErickO•2y ago
Packages that I feel should be dev dependencies but aren't. The latest is Mocha
who says it isn't? it's a matter of config really, when you flag something as a dev dependency people are able to npm i --production and install ONLY the dependencies that are required for prod and not for development but npm doesn't know which ones are prod and which ones are dev dependencies, YOU have to tell npm so, you can install ANY npm package as prod or as dev dependency, nothing stoping you from saving everything as a dev dependency you would just be labeling them the wrong way so...does it matter much? yes and no, if you have people compiling your app from source code it would be nice of you to label everything correctly so they are only downloading dependencies actually needed, but if you don't label dev dependencies as such you're not breaking the app you're just making them download more stuff than actually needed
ErickO
ErickO•2y ago
idk who told you mocha isn't dev dependency btw, their official page tells you to save it as such unless you save it globally
JWode
JWode•2y ago
Interesting, thanks. Yeah that's kind of what I thought - that it would just be unnecessary in production.
JWode
JWode•2y ago
Maybe it's just npm?
ErickO
ErickO•2y ago
hmm I think that's default you have to specify to npm it is a dev dependency which seems like they didn't lol
JWode
JWode•2y ago
Yeah, I think I'll stop relying on npm's descriptions and go to the official docs 😄 Thanks again
ErickO
ErickO•2y ago
no prob
JWode
JWode•2y ago
chai... sinon... all dependencies, even in official docs ...I'll stop now 😄
Want results from more Discord servers?
Add your server