For import fix, support path mapping value that begins in "./" or ends in ".ts"#21035
Conversation
|
|
||
| /** Convert "./x" (and "././x") to "x". */ | ||
| function removeLeadingDotSlash(path: string): string { | ||
| return startsWith(path, "./") || startsWith(path, ".\\") ? removeLeadingDotSlash(path.slice(2)) : path; |
There was a problem hiding this comment.
the two relative paths are not relative to the same thing.. the input is relative to the current file, but the path is relative to the tsconfig.json. do not think removing the ./ is the right thing to do here. you probably want to expand both, or normalize one in terms of the other if it starts with a ./ or a ../
There was a problem hiding this comment.
The two parameters to tryGetModuleNameFromPaths are relative to the baseUrl. I pushed a commit that updates their names.
There was a problem hiding this comment.
ahh.. good to know :)
what about ..\?
There was a problem hiding this comment.
Good catch, that needed a fix too.
There was a problem hiding this comment.
can u use getNormalizedPathComponents instead?
6908254 to
0ca56de
Compare
Fixes #20525