Should a library used by getStaticProps be a normal or dev dependency?

Viewed 35

I'm using a library in NextJS's getStaticProps. As such the library will only be used as build time. Should this dependence be a normal or dev dependency in my package.json?

1 Answers

It doesn't matter where you have it in this case where you are building a website. Making the difference between devDependencies and dependencies is important if you are creating a library that other developers will install with npm i packageName.

As an example if you install axios you install along everything in its dependencies. And those get registered in your package-lock.json but not its devDependencies, as you don't need them, as they are only for axios's creators to develop it and test it.

Here are is a quote about devDependencies from npm's official doc:

If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use.

Related