Install devDependencies and dependencies together with yarn

28,459

Solution 1

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

Solution 2

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/

Share:
28,459
Pranesh Ravi
Author by

Pranesh Ravi

Design and Code <3

Updated on November 10, 2020

Comments

  • Pranesh Ravi
    Pranesh Ravi over 3 years

    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.