-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Absolute paths are not resolved in tsconfig.json paths #792
Comments
I think your
So you should do {
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist",
"paths": {
"alias/*": ["subdir/*"]
}
}
} |
Thanks for the heads up. This is currently missing test coverage, and is a bug in esbuild. Will fix.
TypeScript's notion of "resolving relative to" involves not doing resolution for absolute directories. Here is the documentation from the actual code in the compiler that ends up doing this:
|
Hey Evan, I believe I found a bug. When
tsconfig.json
has absolute paths in itscompilerOptions.paths
, ESBuild doesn’t resolve these paths properly.Details
Consider the following
tsconfig.json
(with an absolute path in its alias):With this
tsconfig.json
and files likeESBuild won’t find
alias/subfile
:The error would go away if we replace the absolute path with the relative one:
From my experiments, this issue affects at least:
extends
fieldcompilerOptions.paths
fieldRepro
Repository: https://github.com/iamakulov/esbuild-tsconfig-repro
Steps to reproduce:
When this matters
This doesn’t matter in general, since pretty much every
tsconfig.json
uses relative paths. However, this matters for autogenerated tsconfigs – where relative paths are more complicated to compute (as they are relative tobaseUrl
which may be inherited). In that case, absolute paths are more convenient. (Semi-related to #783.)The text was updated successfully, but these errors were encountered: