heroku / heroku/heroku-buildpack-nodejs

Yarn rebuilds native dependencies during pruning

Open
#526 5 comments 0 reactions 0 assignees View on GitHub
bug needs investigation
Dominant language
Shell
Stars
1.3k
Forks
2.6k
Avg merge
1d 13h
Merged PRs (30d)
30

Description

Hi!

For one of our projects, the durations of the nodejs buildpack part of our compile are as follows (all times are with zero changes to `yarn.lock` since the last build):
* Prior to #519: 16 seconds ([log excerpt](https://emorley.pastebin.mozilla.org/9078913))
* After #519 (and after an interim build to warm the cache with devDeps): 42 seconds ([log excerpt](https://emorley.pastebin.mozilla.org/9078914))
* After #519 and with setting `YARN_PRODUCTION=true` + interim build: 45 seconds ([log excerpt](https://emorley.pastebin.mozilla.org/9078915))

From both reading the last of the linked logs and from looking back over the PR, It seems that even with `YARN_PRODUCTION=true`, the pruning step still happens (and in our case takes quite a while - likely in part due to yarnpkg/yarn#932).

Is this intended? I would have thought that for those installing only `dependencies` (via `YARN_PRODUCTION=true`), the prune step would not need to run at all?

Many thanks :-)

Contributor guide

Open the contributing guide

Research direction

Start by comparing PR #519 with the three linked build logs, focusing on the pruning step when YARN_PRODUCTION=true. Trace the buildpack entry point that installs and prunes dependencies. Done means the production path no longer performs unnecessary pruning, with the behavior confirmed by build output and timing.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, shell
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.