It's probably the most famous dilemma after Chicken or the egg, should I install this dependency in dependencies or in devDependencies?
Let's see what
yarn say about it:
dependencies: Packages required by your application in production.
devDependencies: Packages that are only needed for local development and testing.
dependencies: These are your normal dependencies, or rather ones that you need when running your code (e.g. React or ImmutableJS).
devDependencies: These are your development dependencies. Dependencies that you need at some point in the development workflow but not while running your code (e.g. Babel or Flow).
There is a discrepancy between the two approaches, because
npm is suggesting to install modules like
@types (needed at build time) as
yarn is suggesting to install them as
devDependencies. So what to do?
create-react-app, that is maintained by Facebook (same maintainer of
yarn), is installing all the
yarn) not accordingly to what suggested by
Another reason to adopt the
npm convention is installing dependencies with
npm install --production or
yarn --production is going to install only the packages inside
dependencies, excluding the one in
devDependencies. This could be particularly helpful if you want to install all the dependencies needed to spin up your project. This is not possible if you have your
babel files in
Can you build and run your application without this dependency? Yes,