I’ve decided to write my first library in Typescript, which is here.
I’ve got some questions that I don’t think is suitable for StackOverflow because it’s quite case-specific rather than being generic and I’ve got a couple of them rather than one.
I’m trying to wrap my head around JS/TS module system for some while. There are some problems with my library:
- If a user imports a hook, they have to do
import { useDocument } from 'firereact/firestore/useDocument'
, but it’d be much better if they could doimport { useDocument } from 'firereact/firestore'
. I’ve tried many ways but I couldn’t export it tofirestore/index.ts
I guess. What am I doing wrong? - I have realized that consumers can also import test modules and
firebase.ts
, which are only used for testing and it is not desirable for them to be imported by the consumers. How can I ignore some specific exports while bundling? They are meant to be used internally.
Thanks in advance. And btw, extra reviews and critics are appreciated since this is going to be my first library.
You must log in or register to comment.