-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Unable to resolve path when import uses path relative to baseUrl
#68
Comments
We're using |
I just tested it with const lib = require('tsconfig-paths')
const config = lib.loadConfig()
const f = lib.createMatchPath(config.absoluteBaseUrl, config.paths)
const result = f('foo', undefined, undefined, ['.ts', '.tsx', '.d.ts'])
console.log(result) After some debugging it seems like the problem is with this condition: Because of this the function returns It seems that the problem happens when we have a module that lives outside of the base URL. If I remove that early return then my test works as expected. It doesn't seem to break any of the other tests. Do you know why that condition was added? |
@teoxoy Any idea? |
It looks like it was added as part of ad33780#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R125-R128. It was most likely a misunderstanding on my part on how @OliverJAsh could you put up a PR for this and remove those few lines of code? |
* Failing test * Remove redundant condition Fixes #68
* Failing test * Remove redundant condition Fixes #68
released v2.4.0. |
This is a difficult one to describe but here is a failing test: OliverJAsh@e26fed2
Essentially the issue occurs when we import using a path that is relative to the
baseUrl
, e.g. given:tests/withPaths2/tsconfig.json
:tests/withPaths2/root/foo.ts
:tests/withPaths2/other/bar.ts
:This fails with the following error:
This is a valid import—TypeScript understands it so I think this resolver should also understand it.
The text was updated successfully, but these errors were encountered: