I'm pretty sure I must be wrong but in Node, path.relative seems to output the wrong directory, or at least one I wasn't expecting:
> path.relative('a/file.js', 'a/file.css')
> '../file.css'
However I would expect the result to be something like:
> './file.css'
In essence I am trying to compute the difference in the two paths in order for one file to require
the other and ../file.css
is obviously wrong for my require as both the files are in the a
directory. The output suggests that file.css
is in the parent directory.
What am I missing?
path
methods. Thanks! – Gehman