0

Especially when deploying a node app with node modules to a embedded system, I am struggling with a size of node modules.

When I do npm install, it downloads not only the required sources but also other files, for instance Socket.io (0.9.16) contains 12 MB dependencies -- after a short investigation, I've realized that it depends on zeparser, which just contains 8 MB file (benchmark.html) that does not seem to be needed for production.

Is there already a way how to depend on modules and tell npm (or other package manager) to install just the source files (not documentation, benchmarks, etc.)? Or do I have to still manually maintain the list of not needed files for each module?

(Only what I have found is dedupe module, which remove nested duplicated dependencies.)

TN.
  • 18,874
  • 30
  • 99
  • 157
  • 1
    possible duplicate of [Compacting node\_modules for client-side deployment](http://stackoverflow.com/questions/17239083/compacting-node-modules-for-client-side-deployment) – Pete TNT Aug 15 '15 at 09:37

1 Answers1

-1

The module author can use .npmignore to ignore specific (test) files that are not related on the release. Also the npm install will download compressed files that contain the complete package.

https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package

Tom V.
  • 315
  • 2
  • 10
  • It seems to me, that .npmignore is used for package upload. `npm install` download files already filtered by that. – TN. Aug 15 '15 at 15:55
  • That's correct. I think it's not possible because the packages are downloaded as an archive. – Tom V. Aug 15 '15 at 16:18