Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
getRelativePath
behaviour on case-insensitive filesystems
Typically when resolving an import in file `A/a.ts` "from" file `B/b.ts` e.g. import x from "../B/b" the function will be called as `getRelativePath("A", "b")`. Note the `"b"` path has been lowercased by tsc at some point and that `"A"` may not exist on disk at this point as it's being generated. The previous logic would fail on `realpathSync.native(from)` because `from = "A"` does not exist on disk yet and would not fix the casing of `to`. As such `"../b"` would be returned instead of the correct `"../B"`. The simplest fix is to swap the realpath calls which is what we do here, as typically `to` will exist (it's what is being imported) and `from` may not.
- Loading branch information