As you probably know already, in Node.js modules are cached. So if you
require the same module in multiple files across your application, it won't get loaded multiple times and it won't take more memory.
However, I believe it's always a good practice - and I try to stick to it - to only require the modules you need. Adding libraries which you "may or may not use" will certainly increase the memory footprint and deployment size. I mean, Node.js apps have the potential to be fast and lean, but one could easily turn them into sluggish and bulky by
requireing the whole npm registry :-)
For instance, I was using
commander during development/deployment and legacy-data importing phase in a recent project. Those modules weren't necessary in production, so I added them in
devDevelopment section of
package.json, but they were still being deployed to Heroku, so I had to specifically add them to
.slugignore. As a result, the slug size went down from 20 MB to 16 MB.
So I'd say there's no generic answer to your question; the only way to actually know is testing...