I'm sure I should be wrong, but in Node, path.relative seems to display the wrong directory, or at least I did not expect:
> path.relative('a/file.js', 'a/file.css') > '../file.css'
However, I expect the result to be something like this:
> './file.css'
In essence, I am trying to calculate the difference in two ways, so that one file is require other, and ../file.css is obviously wrong for my requirement, since both files are in the a directory. The result shows that file.css is in the parent directory.
What am I missing?
source share