Create App - Centralized/Single Node Modules

Scenario:

Upon App creation a sub folder is created, called: node_modules
node_modules ends up being roughly 200 MB is size once boiler plate modules are installed (ie. bootstrap, etc).

I have create 5 separate Applications.
Each App having its own copy of node_modules.
Collectively, the 5 Apps are using roughly 1GB of disk.

However, the Source Code for all 5 Apps is less the 15 MB.

Question:

Are there any thoughts given to having a single shared node_modules location?

I see that the package.json contains a dependencies & devDependencies sections.
Maybe an attribute could be added to identify the location of a shared node_modules location to be used instead of each App having its own copy…

We have about 30 apps that we are looking to convert from CanJS, ExtJS and other technologies to DoneJS.
Having 200 MB of node_modules for each App quickly eats up disk space not to mention storage in Version Control system.

Just curious if any thoughts have been given to having a shared node_modules location for DoneJS apps.
And/or if I missed something on how this can be accomplished, please point me in the right direction.

Many Thanks!

It wouldn’t be realistic to share a single node_modules folder between all of the apps, but you could try to symlink each folder of the shared DoneJS dependencies. If you ever needed to upgrade the modules in one of the apps, all you’d have to do is remove the symlink from the application and npm install the new modules for that specific app.

  1. Don’t add node_modules to version control, ever
  2. Docker ignore node_modules; use npm install within dockerfile
  3. If you’re desperate, symlinking & npm prune can help reduce this further, especially if you’re pulling down a lot bunch of interrelated repos