DEV Community

Cover image for I reclaimed 10GB of disk space from node_modules

I reclaimed 10GB of disk space from node_modules

Mike Bifulco on April 03, 2019

I really don't like my laptop. I've been using a 2017 Macbook Pro for the past couple years. As I'm sure you've heard, it is a fiercely...
Collapse
 
tunaxor profile image
Angel Daniel Munoz Gonzalez

I have been using pnpm primarily for more than a year
and lately I've been using it for monorepo's and works quite nice

now something that's funny but you may think it's a pnpm problem sometimes are that you need to install more devDependencies for the project to actually run (not always but I've seen it)
and this is because if a dependency requires lodash for example, with the flat npm node_modules, you can require lodash without even having it on your package.json (you can inspect the node_modules and you'll find it there)
this is not true with pnpm, you need to actually put it on your package.json to have access to it.

I think pnpm is often underrated, but it is actually a nice tool.

Collapse
 
sqlrob profile image
Robert Myers

Honestly, this feels like the correct behavior to me. The dependencies of another package are an implementation detail and if they change, your project could break.

Collapse
 
irreverentmike profile image
Mike Bifulco • Edited

Not arguing that at all - I'm totally onboard with it. The whole family of dependencies needs to be there (and locked to a version) for things to work repeatably. I just needed some disk space back. As long as you don't mind running yarn or npm install when you come back to working on a given project, this seems to be a perfectly functional way of working to me.

Edit: Just realized you weren't replying directly to my post! Ha - well, seems we may be on the same page anyway. 🍳