How to package npm library with multiple directories without having to go through src

Viewed 9

I have an internal npm package called @scope/ui.

The code is structured like so:

- ui 
│ - components 
│ - node_modules 
│ - themes 
└ package.json 

To use themes for example, one would reference it like so:

const { theme1 } from '@scope/ui/themes'

To use components, one would do:

const { Button } from '@scope/ui/components'

However, I would like to move the components and themes directories under a src directory.

Only problem is, I don't want to have consumers of the package to then have to do:

const { Button } from '@scope/ui/src/components'

How can I move the components and themes directories under a src directory, but allow consumers of the package to avoid having a src segment in the path?

0 Answers
Related