Dependencies (aka `require`s) are resolved synchronously. So the flow is: A --> B --> C A --> C
Also modules are cached. [1] ie, they are not loaded twice. A and B "see" the same version of C. [1] http://nodejs.org/docs/latest/api/modules.html#modules_caching Hope this helps, danmilon. On 01/14/2013 09:45 PM, Thiago Souza wrote: > Hello all, > > I've got a basic dependency question. Consider the following > dependencies: > > (module A) --> (module B) (module A) --> (module C) (module B) --> > (module C) > > So, C is a shared dependency between A and B, but A also depends on > B. My question is, will A and B share the same C module instance? > If so, what code base will be used? > > Cheers, Thiago Souza > > > > > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > > You received this message because you are subscribed to the Google > Groups "nodejs" group. To post to this group, send email to > nodejs@googlegroups.com To unsubscribe from this group, send email > to nodejs+unsubscr...@googlegroups.com For more options, visit this > group at http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en