HNHacker News
TopNewBestAskShowJobs

arthurwhite

22 karma · joined June 14, 2017

submissionscomments
arthurwhite··on NPMprune: Remove unnecessary files from node_modules to optimize storage
Maybe not on their machine, but for Docker images that will be pulled a thousand times, yes.
arthurwhite··on NPMprune: Remove unnecessary files from node_modules to optimize storage
Not everyone uses the .npmignore file. Maybe it's the author's choice, but in the meantime, that's my personal storage space that's being used unnecessarily.

I tested it recently on a clean install of Strapi: about 250 MB are freed up. Storage is cheap but that still represents a lot, especially inside a Docker image.

The patterns used to find files are specific enough to target only those files that are well known to be useless at runtime.

arthurwhite··on NPMprune: Remove unnecessary files from node_modules to optimize storage
While pnpm optimizes storage and reduces duplication, it does not inherently remove non-essential files (like documentation, Markdown, or test files) within the dependencies.

Also, when you create a Docker image, you avoid packing in dev tools that aren't absolutely essential (such as pnpm).

arthurwhite··on NPMprune: Remove unnecessary files from node_modules to optimize storage
Because its primary focus is on redefining how dependencies are stored and accessed, rather than modifying the contents of these dependencies.

Useless files will still be there.

Also, when you create a Docker image, you avoid packing in dev tools that aren't absolutely essential (such as Yarn).

arthurwhite··on NPMprune: Remove unnecessary files from node_modules to optimize storage
If everyone used the `file` field, the world would be a better place, for sure.
arthurwhite··on NPMprune: Remove unnecessary files from node_modules to optimize storage
- Of course, this entails the risk of occasional breakage. But for 99% of modules, this has no impact at runtime.

- The patterns used to find files are specific enough to target only those files that are well known to be useless at runtime.

- The license texts of these libraries can be copied and merged into a main LICENSE file.

- Have you seen the number of modules installed by most major libraries? Making a pull request for each of them is humanly impossible and counter-productive. It's easier to use a simple script that releases dozens of MB in a few seconds.