Adapting __filename and __dirname #1

Open
jrburke opened this Issue Aug 6, 2013 · 1 comment

Comments

Projects
None yet
2 participants

jrburke commented Aug 6, 2013

If you wanted to allow for converting node modules that use __dirname and __filename, you could adapt those in the define function that is added by using this (what I use for the r.js converter):

var preamble = 'var __filename = module.uri || "", ' +
              '__dirname = __filename.substring(0, __filename.lastIndexOf("/") + 1); '

I only do this if I detect __dirname or __filename.

Owner

domenic commented Aug 8, 2013

Right yeah, this is a pretty cool feature. I'll leave this open until someone actually has a use case for this in a project though... as of now amd-wrap exists only for Q, which doesn't need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment