Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reason behind the division of devDependencies and dependencies?

See original GitHub issue

Hi, 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:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

gaearoncommented, Mar 8, 2017

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, and devDependencies 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.

FezVrastacommented, Mar 8, 2017

Yes this is another approach and I’m okay with it, but create-react-app makes use of whatwg-fetch, object-assign and others which, following your idea, should go in dependencies because they will be directly used by the app.

Same for webpack and others, in your specific case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Difference between dependencies, devDependencies and ...
A dependency is a library that a project needs to function effectively. DevDependencies are the packages a developer needs during development. ...
Read more >
dependencies or devDependencies
However, if we correctly divide our dependencies, deploys will take a little less time because we are only installing the dependencies that we...
Read more >
Why does npm have 2 categories of dependencies?
Having the two categories is helpful because you don't want development-time things being packaged with your code when you publish it.
Read more >
Demystifying `devDependencies` and `dependencies`
When an application is fed into a module bundler, like Webpack or Rollup, all required dependencies are pulled together and bundled (as the...
Read more >
NPM: devDependencies vs dependencies in package.json
devDependencies: This property contains the names and versions of the node modules which are required only for development purposes like ESLint, JEST, babel...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found