Tried using this module on Linux, and it seems to do a great job.
Though on a Windows environment it seems that the resolve for root here breaks the local descendant output due to generating the root in a different format. Originally, the root passed to configResolved is in the format of /Users/..., but the resolve() changes it to the format of C:\Users\....
The resolveId's importer variable follows the root variable's path scheme, so the isLocalDescendant function will never be able to correctly validate that the path starts with root (as it compares format of /Users/... to C:\Users\...). It also additionally uses sep after the resolve, which seems to be always / for importer's paths (instead of sep's value \ on Windows) from my testing.
Changing the mentioned line to root = (opts.root || root) + '/'; seems to fix the issue on both OSes, though I don't know if this is a good fix due to opts.root being configurable by the user and it could follow the C:\Users\... format too due to usage of e.g. process.cwd() or path.join().
Tried using this module on Linux, and it seems to do a great job.
Though on a Windows environment it seems that the resolve for root here breaks the local descendant output due to generating the root in a different format. Originally, the
root
passed toconfigResolved
is in the format of/Users/...
, but the resolve() changes it to the format ofC:\Users\...
.The resolveId's
importer
variable follows theroot
variable's path scheme, so the isLocalDescendant function will never be able to correctly validate that the path starts with root (as it compares format of/Users/...
toC:\Users\...
). It also additionally usessep
after the resolve, which seems to be always/
for importer's paths (instead ofsep
's value\
on Windows) from my testing.Changing the mentioned line to
root = (opts.root || root) + '/';
seems to fix the issue on both OSes, though I don't know if this is a good fix due toopts.root
being configurable by the user and it could follow theC:\Users\...
format too due to usage of e.g. process.cwd() or path.join().