Install devDependencies and dependencies together with yarn

Pranesh Ravi picture Pranesh Ravi · Apr 10, 2018 · Viewed 12.1k times · Source

Is it possible to install devDependencies and dependencies together with yarn?

For example, if I want to install react and webpack. React is a dependency and webpack is a dev dependency. To install both, I need to run these two commands

yarn add react
yarn add webpack -D

Is is possible to combine them into one command or is there any alternative? Like installing both devDependencies and dependencies at the same time without running multiple commands.

Answer

Kacper Wiszczuk picture Kacper Wiszczuk · Aug 13, 2018

I don't think it is possible. Documentation does not specify such option, and if you provide at least one flag modifying type of dependencies - all dependencies specified in a command will become this type. If you really want to be one command to paste into command line you could do this:

yarn add react && yarn add webpack -D