2

I'm using modern Yarn (v3.2.4 to be exact) which differs from Yarn Classic.

I'm using the nodeLinker: node-modules option in .yarnrc.yml so /node_modules are created, and dependencies are not saved to the repo.

I want to install only production dependencies (no devDependencies) but the --production flag isn't support in in Yarn 3. How can I do this?

James
  • 615
  • 1
  • 4
  • 22

2 Answers2

3

You can use the yarn workspaces focus --production command. Check out the documentation here.

Bobby
  • 31
  • 2
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 12 '23 at 07:49
2

As user Bobby mentioned in the other answer, it is possible to install only production dependencies by using the Yarn Workspace plugin.

This requires that the plugn be installed first: yarn plugin import workspace-tools.

Then install with: yarn workspaces focus --production.

James
  • 615
  • 1
  • 4
  • 22