I'm building a library with no default export, but a whole set of sub-exports. It's documentation for a set of APIs, so each API is exported from its own sub-directory. There is no central API info that should be exported from, say, dist/index.js
, but instead, there's dist/api-one/index.js
, dist/api-two/index.js
, etc.
Currently, I'm importing like so: import { SomeFeatureOfApiOne } from 'my-package/dist/api-one
But it'd be nice to be able to get rid of the dist
in the import path, since everything will have it. I know the files
parameter just determines which directories are included in the export, so that doesn't work, and it appears that main
is for the actual module file, not a directory.
Is there a way to do this? I was thinking of maybe a postinstall
script that moves the sub-directories from /dist
to root, but that feels super hacky to me, so I was hoping there was a neater way.