I am learning typescript and I would love to begin experimenting packages creation.
Here is my folder structure for the moment:
myProject/
├── node_modules/
├── src/
│ ├── app
│ ├── index.ts
│ ├── packages
│ ├── database
│ ├── index.ts
├── package.json
├── tsconfig.json
As you can see, my src folder is divided into app that will contain my application implementation and a package folder that is supposed to be more "abstract", in order to become one day a package eventually.
What I would like, would be to access to my packages modules writing the following in my app folder:
import Database from 'packages/database';
instead of
import Database from '../packages/database/index';
I looked around the paths configuration into the tsconfig.json file but I could not get it to work:
{
"compilerOptions": {
...
"baseUrl": ".",
"paths": {
"packages": ["src/packages"]
}
}
}
I would also like to keep access to the node_modules folder of course...
How could I achieve that?
Thank your for your replies