How to use typescript relative/absotule paths

58 views Asked by At

Right now I need to write import { MyFn } from '../lib/myUtils'; instead of import { MyFn } from 'lib/myUtils';.

My structure is:

tsconfig.json
src - 
    index.ts
    lib
       - myUtils
    ....

I dont want to use any external library like module-alias, I don't want to use @ like in @lib/myUtils.

I just want to call import { MyFn } from 'lib/myUtils';.

How do I set up my compiler options?

1

There are 1 answers

0
Paul Huynh On

Use "baseUrl": "./" in your tsconfig.json file.

Reference