DEV Community

Discussion on: npm dependencies and devDependencies

Collapse
 
jhotterbeekx profile image
John Hotterbeekx

I find an easy way to remember this is to try and think if the library is needed in the actual code, like importing in a component, or not. If you import it somewhere in the source of your code, it should be a dependency. If it is only used when building (e.g. Webpack or a Webpack loader), testing, or in a package.json scripts or any outside tool, then it should be development dependency. And always try and have as few regular dependencies as needed, if it can be a development dependency, it should!