dividab / tsconfig-paths

Load node modules according to tsconfig paths, in run-time or via API.
MIT License
1.8k stars 100 forks source link

fix: regard file extensions during path resolution (#133) #193

Closed aleclarson closed 2 years ago

aleclarson commented 2 years ago

Originally during the file path resolution, file extensions were removed without explicit reason. This commit changes the resolution logic to keep file extensions, with the goal to add support for modern non-js extensions like cjs. The change however keeps /xyz/index resolves as is as they still should resolve to /xyz.

Refs 847d314

jonaskello commented 2 years ago

Thanks! :-)

jonaskello commented 2 years ago

Released in 3.13.0

JiangWeixian commented 1 year ago

Just curious about why remove extensions from path...

https://github.com/dividab/tsconfig-paths/blob/11b774d994b897c6c8e87dda57375a285813731d/src/try-path.ts#L58-L69