I would like to break up my NPM package in to more workable parts.
In my application requiring the package, instead of
import { myFunction } from 'my-package'
I want
import { myFunction } from 'my-package/submodule'
My package has a number of files in src folder and then an index.ts which just exports them all.
package.json main points to dist/index.js already.
My package builds to dist directory so
import { myFunction } from 'my-package/dist/submodule'
and
import { myFunction } from 'my-package'
both work.
One solution may be to copy all compiled files to package root but this feels untidy.
Maybe there is a way make the dist folder the root? I can't find this in the documentation.
D3 and Lodash manages this but I think it's done at build time. I couldn't work out how they managed it.