tspath icon indicating copy to clipboard operation
tspath copied to clipboard

Path resolution has too many `..` when `paths` does not stem from project dir

Open joergplewe opened this issue 3 years ago • 0 comments

What I try to do: Use some TS code somewhere in my project tree as a library by referring it by a paths mapping.

It seems that path resolution goes wrong when a paths reference does not stem from the project dir (where tsconfig.json is), e.g. has a .. in it. Like this:

 "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "@lib/*": ["./../lib/src/*"]
    },
    "outDir": "./dist",

In this case, the resolved path has one .. too much.

This also holds when shifting the baseUrl up:

 "compilerOptions": {
    "baseUrl": "./../",
    "paths": {
      "@lib/*": ["./lib/src/*"]
    },
    "outDir": "./dist",

joergplewe avatar Dec 30 '22 12:12 joergplewe