peerDependencies/dependencies for an internal ui react/sass package

54 views Asked by At

I am looking for some clarification on how to manage packages correctly in a monorepo npm workspaces setup. Consider the following project structure

/apps
 /nextjs-app-1
 /nextjs-app-2
/ui
 /src
  /components ...react ui components

the ui package has no build process but components are imported directly into the nextjs apps which handle the build process in the end.

say one of my components in the ui packages uses react-youtube, is it then good practice to add that as a dependency or a peerDependency in the ui package? Why? Should react and react-dom also added as a dependency or a peerDependency in the ui package?

All components are also written in typescript, how would this be handled in this setup?

I have added required packages as peerDependencies and everything seems to work - but I would like to have a deeper understanding of why and whether this is the "right" way to do it

0

There are 0 answers