heroku-buildpack-nodejs: Yarn cache does not work by default
Hi, the docs
https://devcenter.heroku.com/changelog-items/1082 https://devcenter.heroku.com/articles/nodejs-support#cache-behavior
suggests that yarn caching works by default. My builds consistently showed however that only node_modules was being cached, which is insufficient for yarn workspaces and also inconsistent with what the docs seems to specify above.
I tried setting cacheDirectory to the output of heroku run yarn cache dir but alas no avail.
After much digging I found out the buildpack sets the yarn cache dir to a temporary location: https://github.com/heroku/heroku-buildpack-nodejs/pull/459
I tried working around this by having the following in package.json:
"heroku-prebuild": "export YARN_CACHE_FOLDER=/app/.cache/yarn/v4"
But this did not help the problem.
What would really help would have been the following PR which was never merged: https://github.com/heroku/heroku-buildpack-nodejs/pull/615
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 24 (11 by maintainers)
Finalized in v173: https://github.com/heroku/heroku-buildpack-nodejs/blob/master/CHANGELOG.md#v173-2020-07-16
👍will
yarn cachecache built modules as well? I’m mostly trying to avoid rebuilding dependencies on each install.