a patch for node.js which avoids loading the same module more than once
In a large project developed with node.Js, some modules are used frequently, let's say underscore or lodash.
module A is depended on underscore
,and module B is depended on it too, they are depended on the same version.
So module underscore is loaded more than once , right? And that may cost a lot memory, very unnecessary .So why don't
we set the cache for the same module with the same version. Well , module-unique can help you solve this!
npm install module-unique
add the code before your own code, must before or it won't work!!!
require('module-unique').init();
memory used about 30% above in my own project!