yarnpkg / yarnpkg/berry

[Best-Practice] Using yarn in production, using cache to populate `node_modules`

Open
#6,166 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Is it a good practice to use yarn in production?

Cons:

  • docker best practices suggest to create prod images as small as possible, which would mean excluding yarn from the image - It's also an additional possible point of failure in your app
  • In case of monorepos you're adding the deps of all the other repos (unless you carefully use pnpIgnorePatterns)

Pros:

  • the fact that dependencies are zipped translate to a smaller bundle size.

In case I want to stop using yarn in production, is there a way to populate node_modules from the .yarn cache, without passing through the registry?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Yarn's production-install behavior, the .yarn cache, node_modules population, and Docker image practices described in the issue. Document whether production can avoid Yarn and the registry while using the cache, including any monorepo constraints; no files or tests are named.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, node.js
Domain
devops, tooling
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.