Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getRelativePath behaviour on case-insensitive filesystems #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Apr 26, 2024

  1. 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.
    sammko committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    caba646 View commit details
    Browse the repository at this point in the history