duojs / duo

A next-generation package manager for the front-end
3.42k stars 118 forks source link

stdin root: seems to be getting ignored #426

Closed matthewmueller closed 9 years ago

matthewmueller commented 9 years ago

example:

$ duo -r . -t js < test/index.js > build/build.js

this does work though:

$ duo --stdout test/index.js > build/build.js
dominicbarnes commented 9 years ago

That's strange, what doesn't work exactly? I just tried it and I didn't have any issues

matthewmueller commented 9 years ago

oops, didn't leave enough info. in test/index.js there was a require('../'). So I don't think the root path is properly working with stdin.

dominicbarnes commented 9 years ago

Ooooooh, you mean the root parameter is being ignored. I thought you meant that stdin itself was being ignored.

matthewmueller commented 9 years ago

haha yah, my bad, wrote this in a hurry

dominicbarnes commented 9 years ago

After digging around at this, turns out it's not a bug per se. Since you're using stdin on test/index.js, the relative paths cannot be resolved as you would expect, since the root is a directory higher.

If you use require('.'); from within test/index.js, it will include the root module. But of course that doesn't make sense, since that relative path is no longer relative to your source file. Your only other option is to use require('/'); (which works in both stdin mode and entry mode)

dominicbarnes commented 9 years ago

It's worth pointing out, this is just a trickiness that comes up while dealing with entries coming from stdin, so I think I will close this issue. (feel free to re-open if I am in error)