Reason behind the division of devDependencies and dependencies?
See original GitHub issueHi, I searched in the past issues but I couldn’t find anything related.
I’m wondering why do you leave in dependencies
only react
and react-dom
and all the other dependencies are under devDependencies
?
I studied a lot about the distinction between the two lists, and to me, everything should go under devDependencies
because none of them will be used directly by the compiled app, because Webpack will bundle them together into a single pack, meaning that if I do npm i my-app
I could directly use it without having to install any dependency at all because the bundle would be already shipped in the npm bundle.
I know it’s a bit abstract because the purpose of create-react-app
is not to publish apps to npm, but it’s the only way I can reason about dependencies
vs devDependencies
.
May you shed some light on the argument please?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
There’s no real difference because the app has a build step, and produces a static bundle. So Node meaning doesn’t quite apply here.
I’m trying to use
dependencies
for libraries that end up in the bundle, anddevDependencies
for stuff that is related to build tooling. As you noted with polyfills it isn’t such a clear distinction. However, I think it can be helpful to get a sense of what’s needed for the build versus what’s used by the app.Yes this is another approach and I’m okay with it, but
create-react-app
makes use ofwhatwg-fetch
,object-assign
and others which, following your idea, should go independencies
because they will be directly used by the app.Same for webpack and others, in your specific case.