The NODE_PATH environment variable can be used to specify an alternative module folder. This can be useful for preventing long relative paths. Imagine the following folder structure:
/index.ts
/src/
---/folder1/
------/service.ts
---/folder2/
------/util.ts
If I want to use the service from folder1 in util from folder2 I need to do an import { ServiceName } from "../folder1/service". This can become tedious with deeply nested folders.
When you set the NODE_PATH environment variable to './src' you can import the same service from "folder1/service". As you can see, no annoying relative paths.
I have tested this with a plain javascript project and it works great. But when I use typescript it will give a compile error telling it can't find the specified modules because it doesn't seem to use NODE_PATH value.
So the question is, how do I force the typescript compiler to use the NODE_PATH value?