My newest typescript project is split into different modules and submodules.
My file structure:
package.json
(...)
/src
| /module1
| | index.ts
| | (...)
| | /subModule1
| | | index.ts
| | | (...)
| | /subModule2
| | index.ts
| | (...)
| /module2
| index.ts
| (...)
Every (sub)module has a index.ts
file holding the module's exports.
Now I finally want to publish my package. One should be able to import stuff from the modules in the following way:
import { A } from "package/module1";
import { B, C } from "package/module1/subModule2";
I've already used this syntax on importing stuff from other packages on npm. But I can't find any explanations on how to implement such behavior. I've found some article explaining it for multiple files, but not for multiple modules structured in folders and subfolders.