Closed bentomas closed 14 years ago
It would be useful :)
But I don't think it's possible for a function in another module to know what the parent's __dirname
value is. AFAICT require()
has special support for this by virtue of really being a unique function instance for each module that it's injected into. Each private require()
instance knows about the path of the module that it's supporting.
Check out Module.prototype._compile()
in src/node.js
.
I'm closing this, but please re-open if you come up with a clever way to achieve this. I'd love to support this syntax.
Ahhh, yes I think you are right. Shucks. Well, it isn't too big of a deal, I just use postMessage to tell the child script its location and then have the child script require things using its location to create an absolute path.
Keep up the good work!
This would be useful!