-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarn 2: cache is deleted before pruning dev dependencies, making build slow #918
Comments
The cache is deleted because running the prune command does not actually remove the devDependencies. Right now, the cost of a smaller slug size is a longer build, but we can continue to investigate this to figure out if there's a better way to do this. |
Discussion on the yarn berry package suggests that yarn maintainers went the route of not building in this functionality but allowing people to offer it as a yarn plugin:
If you're open to using that plugin, could make it possible fairly easily! |
@danielleadams, @heroku: is there a fix for this, or any movement? our build times have significantly decreased because of it, and i'm concious that it's just putting more pressure on yarn mirrors which are often provided out of generosity- downloading again because you've purged a cache is not very economical. |
@imajes unfortunately, I left Heroku, so I'm no longer on this Issue. |
You can work around this by uninstalling the workspace-tools plugin before this step. heroku-buildpack-nodejs/lib/dependencies.sh Lines 177 to 189 in 5b3fac9
Add in package.json scripts: "heroku-postbuild": "yarn plugin remove @yarnpkg/plugin-workspace-tools", |
@joshwlewis I think this is the thing you mentioned that is still remaining to fix wrt Yarn 2 parity after #978 got merged. |
Thanks for fixing this, v193 appears indeed to work. Hopefully a future v195 will contain the revert of the revert in v194! |
@lizthegrey v195 release does contain #999. It's currently running for only 20% of builds but we'll roll it out more broadly if it appears to handle pruning without tripping over the edge case that caused us to revert #990. |
I'm confused--this is still a problem, no? Can this issue be reopened? See #1056 as an example |
Describe the bug
If you use yarn berry, the buildpack deletes the cache before pruning dev dependencies:
heroku-buildpack-nodejs/lib/dependencies.sh
Line 183 in 70af836
The result is that my builds take way longer than they should because while the first cached build is super fast, when it prunes dev deps it ends up re-downloading all my deps. This sucks! I don't really understand the justification for deleting the cache there, but it adds around 2+ minutes to my builds for a task that should happen near instantly.
For now I'll just disable pruning with theThat doesn't work either, #906YARN_PRODUCTION=false
flag.Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: