nodejs modules and duplication? If an app uses two modules that require a common module, does node optimize to prevent loading the same code twice?
Apologies if this is a dumb question, but if I create 2 modules that both require('http') and my main application that requires both modules, or requires modules that in turn require both modules, while also requiring 'http' for its own purposes, do I end up with three instances of the http module, each locked within the scope of a different closure, or does node rewrite things to avoid this? In other words, do I end up with an app that has: // main app creates a closure containing a local instance of http, an instance of proxy1 // and an instance of proxy2, both of which are functions