-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[BUG] Typescript - Relative path is resolving relative to tsconfig's baseUrl #15891
Comments
The test in the attached PR passes for me, does it capture your set up? |
@pavelfeldman thanks --- that test looks accurate. odd it passes, but fails on my end. i'll try stripping with the other |
We need more information to act on this report. Please file a new one and link to this issue when you get back to it! |
I experience the same issue and seem to have found the cause. There must be a directory (or file) at the top-level that is confusing the path resolver. I.e. the logic of the resolver seems to be “if I can find it at the top-level, take it, but if not, then fall back to relative import”. The original test did not have the top-level entry. I’ve added a failing test in #16338. |
Will be fixed in the next release by #16395. |
Context:
file structure
tsconfig.json
forms_cms_standard.spec.ts
is importing fromutils.ts
relatively.import { ... } from "../utils
.If I remove
baseUrl
fromtsconfig
playwright runs just fine, although I can't do that since the non-relative imports in my codebase will break.This behavior is different from the documented Typescript module resolution, where relative imports should not be affected by
baseUrl
.And this is confirmed when running
tsc --traceResolution
, as it does not error, and resolvesutils.ts
correctlyThe text was updated successfully, but these errors were encountered: