DEV Community

Discussion on: Don't use create-react-app: How you can set up your own reactjs boilerplate.

Collapse
 
sqlrob profile image
Robert Myers

Since react is really a build step, is there any reason not to have react and react-dom in devDependencies instead of dependencies?

Collapse
 
naismith profile image
Chris Naismith

Dan Abramov had mentioned in a CRA, since everything is going through a build step. You should think of it more as everything is a dependency instead of a dev dependency.

Bundle analyzing tools or websites (example bundlephobia) do not read your dev dependencies. I'd recommend keeping it as a dependency!

Collapse
 
nikhilkumaran profile image
Nikhil Kumaran S

React is not a build step, you need React to run your application. classic.yarnpkg.com/en/docs/depend...

Collapse
 
frondor profile image
Federico Vázquez

React per-se doesn't run without this build step. That's why he says that you can list everything under devDeps

Collapse
 
sqlrob profile image
Robert Myers

The current project I'm working on has it all in devDependencies and it works fine.

The project is a little overloaded, it's basically a monorepo with server and client in the same project. All of the client stuff is in devDependencies, everything needed for the server runtime is in regular dependencies.