Live data from Hacker News

NPMprune: Remove unnecessary files from node_modules to optimize storage

github.com

41–50 of 52 posts

Re: NPMprune: Remove unnecessary files from node_modules to optimize storage

#41

I use https://pnpm.io whenever possible. It has many benefits, the main one is that the node modules are symlinked to one big repo in your home directory, so there isn’t nearly as much duplication.

Curious whether this works on Windows? Symlinks are strange there (though hard links work fine on NTFS).

Re: NPMprune: Remove unnecessary files from node_modules to optimize storage

#42
Can someone explain to me why this is even necessary? I have at the time of this comment, 32 node projects on my machine, all with their own node_modules, and I'm using less than 200GB (total, including everything else on my machine) of my total 1TB hard drive space...

Are people that concerned about the size of a directory on their machines?

Re: NPMprune: Remove unnecessary files from node_modules to optimize storage

#43

I use https://pnpm.io whenever possible. It has many benefits, the main one is that the node modules are symlinked to one big repo in your home directory, so there isn’t nearly as much duplication.

Curious whether this works on Windows? Symlinks are strange there (though hard links work fine on NTFS).

If you don't want to risk adding something nefarious to your Google history, DuckDuckGo is a nice alternative.

As my ol' grandpappy used to say, "Why wonder? Let's go search the Internets!"

Re: NPMprune: Remove unnecessary files from node_modules to optimize storage

#44

Can someone explain to me why this is even necessary? I have at the time of this comment, 32 node projects on my machine, all with their own node_modules, and I'm using less than 200GB (total, including everything else on my machine) of my total 1TB hard drive space... Are people that concerned about the size of a directory on their machines?

Maybe not on their machine, but for Docker images that will be pulled a thousand times, yes.

Re: NPMprune: Remove unnecessary files from node_modules to optimize storage

#45

I use https://pnpm.io whenever possible. It has many benefits, the main one is that the node modules are symlinked to one big repo in your home directory, so there isn’t nearly as much duplication.

Another vote for pnpm.

Was introduced at work and it's a game changer. The monorepo support (via "workspace:*") is absolutely clutch too.

Re: NPMprune: Remove unnecessary files from node_modules to optimize storage

#46

I use https://pnpm.io whenever possible. It has many benefits, the main one is that the node modules are symlinked to one big repo in your home directory, so there isn’t nearly as much duplication.

Curious whether this works on Windows? Symlinks are strange there (though hard links work fine on NTFS).

It works. I think the only issue is that you may need to run `pnpm.exe` instead of `pnpm` (or I just installed it incorrectly. Installing on Windows is a bit tougher, but I haven't experienced issues with the symlinks).

Re: NPMprune: Remove unnecessary files from node_modules to optimize storage

#47
post #8

This is wildly unsafe. - Some packages contain non-JS files for good reasons, and they may break in subtle unpredictable ways when you mess with the contents of their package. - Node.js will happily run JavaScript files even if they're not "*.js": A file like "hello.alsdfhlshdfl" works just fine as long as its content parses. There is no guarantee that your dependencies (and their recursive dependencies) don't static…

Removing babel configuration will definitely cause some issues. Depending on your position on the ambiguous situation around TypeScript dependencies, so will *.ts.

Re: NPMprune: Remove unnecessary files from node_modules to optimize storage

#48

Earlier quoted context omitted.

Curious whether this works on Windows? Symlinks are strange there (though hard links work fine on NTFS).

If you don't want to risk adding something nefarious to your Google history, DuckDuckGo is a nice alternative. As my ol' grandpappy used to say, "Why wonder? Let's go search the Internets!"

I'm not sure how to interpret this, other than as an elaborately snarky way of saying "Why don't you google the answer yourself, you lazy bum?"

Re: NPMprune: Remove unnecessary files from node_modules to optimize storage

#49

I use https://pnpm.io whenever possible. It has many benefits, the main one is that the node modules are symlinked to one big repo in your home directory, so there isn’t nearly as much duplication.

Curious whether this works on Windows? Symlinks are strange there (though hard links work fine on NTFS).

It works, as long as you put your source code and the `.pnpm-store` folder to the same drive.
Post reply on HN