pingdotgg / uploadthing

File uploads for modern web devs
https://uploadthing.com
MIT License
3.95k stars 285 forks source link

Is importing react-dropzone really required ? #75

Closed kj-1809 closed 1 year ago

kj-1809 commented 1 year ago

I am probably asking a stupid beginner question , we have react-dropzone in our dependencies in the package folder right so why do we need to install it if we are not using it client side anyway ? won't it automatically import it internally ?

juliusmarminge commented 1 year ago

Since it's a peerDependency, @uploadthing/react doesn't bundle react-dropzone. But since it imports from it, the package must be installed somehow - by the user.

This is similar to for example @trpc/react-query does for tanstack. You might not ever import directly from @tanstack/react-query but trpc needs it.

As to why its not bundled by default, well if you need more functionality than what's bundled by uploadthing, you'd then need to install the package manually. This would potentially lead to a version mismatch between the one bundled in uploadthing and the one used by you. Thats why we use peer dependencies.

kj-1809 commented 1 year ago

Thanks . That makes sense !