Pranesh Ravi
Pranesh Ravi

Reputation: 19113

Install devDependencies and dependencies together with yarn

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.

Upvotes: 76

Views: 117884

Answers (3)

Des
Des

Reputation: 533

I think yarn add --dev @packageName should work

Upvotes: 42

Kacper Wiszczuk
Kacper Wiszczuk

Reputation: 2007

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

Upvotes: 70

Sushim Mukul Dutta
Sushim Mukul Dutta

Reputation: 777

yarn install --production=false should be helpful here I suppose. It should install both devDependencies and dependencies. Here is a link to the reference. https://yarnpkg.com/lang/en/docs/cli/install/

Upvotes: 21

Related Questions