I tested what you said and it working, I didn't think about using require() in this way :-) I still think that this use case should be considered, but it's true that the vast majority of end users will not face with this issue and the two-dots trick can be a good solution, so maybe it's good for now.
El sábado, 15 de febrero de 2014 21:38:27 UTC+1, mscdex escribió: > > On Saturday, February 15, 2014 10:27:35 AM UTC-5, Jesús Leganés Combarro > wrote: >> >> As asked for at https://github.com/joyent/node/issues/7126, when >> defining tests and examples on a Node.js package, you can't be able to >> require() the package itself, needing to do it directly over the Javascript >> files. It's said, instead of >> >> var myModule = require('myModule'); >> >> you needs to do >> >> var myModule = require('../lib/index.js'); >> >> >> > If you have your 'main' in package.json already set to 'lib/index.js', > then all you need to do is `var myModule = require('..');` if you are one > level within the package/module root. To me, that's easy enough. Also it's > not as if end users of the module will have to be dealing with this > problem, so for me the issue isn't that big of a deal. > -- -- 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 --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
