-
Notifications
You must be signed in to change notification settings - Fork 13k
Description
TypeScript Version: 3.7.x-dev.201xxxxx
It appears that
Path substitution fails to resolve module if original path (path before substitution) directory does not exists. E.g. if module is importing module bar
and corresponding package.json
has "main": "src/index.js"
but directory src
does not exists, but substitution path like dist/src/index.d.ts
exists module resolution fails.
Here is the repo with minimial reproducible example illustrating this problem https://github.com/Gozala/bug-tsc-path-substitution/tree/main-field-bug
P.S.: Appears to fail with typescript@next
as well.
Search Terms:
- typeVersions
- path mapping
Code
package.json
{
"name": "bar",
"main": "src/index.js",
"typesVersions": {
"*": {
"*": [
"dist/*"
]
}
}
}
dist/src/index.d.ts
declare class Bar {
}
export default Bar
Expected behavior:
Module resolution should succeed
Actual behavior:
Module resolution fails
Playground Link:
This involves multiple files, please see example repo instead
https://github.com/Gozala/bug-tsc-path-substitution/tree/main-field-bug
Related Issues: