dividab / tsconfig-paths

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

Undocumented Feature: Using cwd to pass custom tsconfig.json path #169

Open akatechis opened 3 years ago

akatechis commented 3 years ago

Hi,

I was trying to figure out how to use a custom tsconfig path (in my project we use tsconfig.json for a "base" config file, then we have tsconfig.server.json and tsconfig.tests.json each of which extend the base tsconfig.json file.

I was trying to find an option to pass the .tests config file, but couldn't find it. I think stumbled on this undocumented feature. If cwd option points to a file, it will be used as the path to tsconfig.json.

This should either be documented or (even better) should be exposed as a more explicit/obvious option and documented in README.

https://github.com/dividab/tsconfig-paths/blob/80bc8106ee580dea5d379e462fdd4cbeb43ecfcf/src/tsconfig-loader.ts#L74-L76