It doesn't work, because require.resolve() only takes one argument, doesn't accept a relative path.
On Thursday, June 28, 2012 12:36:27 PM UTC-4, deitch wrote: > > Strangely, it doesn't work. require.resolve(module,base) does not do it. > It just ignores base entirely? > > On Thursday, June 28, 2012 11:04:27 AM UTC-4, Oliver Leics wrote: >> >> https://gist.github.com/3011868 >> >> > To be more specific, I don't want access to any instance of 'bar', e.g. >> if >> > it appears elsewhere. I want the actual cached instance used by 'foo'. >> > >> > >> > On Thursday, June 28, 2012 9:05:00 AM UTC-4, deitch wrote: >> >> >> >> Let us say I have installed a standard npm module, 'foo' (any >> resemblance >> >> to real modules is unintended and purely coincidental). foo, in turn, >> >> requires bar. After running 'npm install foo;, my root directory will >> look >> >> like: >> >> >> >> app.js >> >> node_modules/ >> >> ..foo/ >> >> ..package.json >> >> ....node_modules/ >> >> ......bar/ >> >> >> >> (irrelevant details left out). >> >> >> >> From my root directory, I can do require('foo') and load foo. >> >> >> >> What if I want access to 'bar'? I *cannot* do require('bar') because >> it is >> >> not in my node_modules path. >> >> >> >> How do I access the 'bar' package from my app? >> >> >> > >> > -- >> > 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 [email protected] >> > To unsubscribe from this group, send email to >> > [email protected] >> > For more options, visit this group at >> > http://groups.google.com/group/nodejs?hl=en?hl=en >> >> >> >> -- >> Oliver Leics @ G+ >> https://plus.google.com/112912441146721682527 >> > -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
