Home > Software design >  Can all dependencies be in devDependencies?
Can all dependencies be in devDependencies?

Time:05-21

Can all dependencies of a React-based website be declared as devDependencies instead of (production) dependencies?

Since the build folder is not versioned together with the code, each checkout of the repository will require a build operation to run the website. Thus every checkout can be considered a development environment.

CodePudding user response:

dependencies is an object of dependencies that the app itself use, E.G react, react-dom.

On the other hand, devDependencies are dependencies that are only used when you're developing or building the package, E.G. webpack, babel, prettier.

Whether you need npm install in production or not, filling these fields appropriately will (at least) provide clarity for the readers.

Now answering your question, module bundlers and transpilers don't care whether the dependency is in devDependencies or dependencies or is it there in the first place. All it cares about that it exists in the node_modules folder.

  • Related