Search code examples
reactjsnpmdependenciesflowbite

If the library I'm building uses a package for icons, does it go under dependencies or devDependencies?


So I am trying to build my first react component library. My library is using flowbite and also react-icons. I've done some reading on the differences but I still am not sure where do these go. I want to say just normal dependencies no? As they are actually needed to build my components when my client would use the library? Not sure about it though?


Solution

  • If you import and use them in your production code(ie should be included to your bundle) - it goes to dependencies.

    Otherwise, if it's needed for building, webpack, tests, storybook stories, typing, linting and stuff like that - it's devDependency

    UPD: Here's small cheatsheet:

    • I use some library in my sources and I want it to be included to my bundle - dependencies
    • I use some library in my sources BUT I don't want it to be included to my bundle(leave it to the end user) OR I know that end user will have this library anyways - peerDependencies
    • I use library as a tool to run/check/build bundle(lint, test, storybook) and everything that will not go to the production code - devDependencies