I have following directory structure for a library which will be imported by other node js project.
my-lib/
├─ dist/
│ ├─ index.js
│ ├─ foo.js
├─ src/
│ ├─ index.ts
│ ├─ foo.ts
├─ package.json
I have following package.json
{
"name": "my-lib",
"version": "1.0.0",
"description": "",
"main": "dist/index.js"
}
I have specified main as dist/index.js, so if I understand correctly, members exported from index.ts (js) can be imported as import abc from 'my-lib'. If I have to access exported members from foo.ts (js) file then I might end up doing import foo from 'my-lib/dist/foo'. So here I have to specify the dist folder name in import path. Is there way to specify just 'my-lib/foo' omitting dist folder name? (just like importing dist/index.js file.)