Module resolution fails when substituion path exists but original path directory does not #41281
Labels
Rescheduled
This issue was previously scheduled to an earlier milestone
Working as Intended
The behavior described is the intended behavior; this is not a bug
Milestone
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 correspondingpackage.json
has"main": "src/index.js"
but directorysrc
does not exists, but substitution path likedist/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:
Code
package.json
dist/src/index.d.ts
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:
The text was updated successfully, but these errors were encountered: