Node module: auto generate entry point from all project exports

Viewed 157

I have a package with the following structure:

components/
  Button/
    Button.tsx
    index.tsx
  Icon/
    Icon.tsx
    index.tsx

I am exporting this as an npm package, to be consumed by another repo. In the importing repo, I am currently importing like so:

import Button from "my-package/components/Button"
import Icon from "my-package/components/Icon"

What I would like to do is import them like so:

import { Button, Icon } from "my-package"

I am aware that to do so, I need to define an entry point. However it seems like I will need to manually import/export all the components to and from the entry point file.

Is there a way to automatically generate such an entry point file, without all the required manual effort?

0 Answers
Related