So the --save-dev flag are things that are needed to develop the project. These dependencies will not be available when the code is in production. Anything installed without the flag will be available to the production code. We need react and react-dom for our app to run in the wild.
This is from the purpose of npm being able to package things up and add them to the npm repository. We're essentially creating an npm package, just like the ones we are installing. If we were to package this up and add it to npm then only the code the is not a devDependency would be available to the end user.
Hopefully that makes sense. Let me know if it doesn't. It's not something I've ever explained before.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Just a small thing: When you install react and react-dom, you didn't add the
--save-dev
. For any reason in particular?I just packed everything into a Dockerfile, and blew with a
Module not found: Error: Can't resolve 'react' in '/data/src'
errorGlad you're enjoying it Nico.
So the
--save-dev
flag are things that are needed to develop the project. These dependencies will not be available when the code is in production. Anything installed without the flag will be available to the production code. We needreact
andreact-dom
for our app to run in the wild.This is from the purpose of npm being able to package things up and add them to the npm repository. We're essentially creating an npm package, just like the ones we are installing. If we were to package this up and add it to npm then only the code the is not a
devDependency
would be available to the end user.Hopefully that makes sense. Let me know if it doesn't. It's not something I've ever explained before.