Skip to content

Yarn version berry's cache folder is increasing slug size #1117

Open
@sbecka

Description

@sbecka

Is your enhancement request related to a problem? Please describe.
Our app just migrated from Yarn version 1 to version 3 (berry), and the slug size for our staging app increased from ~204MB to ~336MB hitting Heroku's soft limit of 300MB. We saw that the .yarn/cache folder was 158MB and included in the slug. Our production app is still on Yarn version 1 and it does not have the .yarn/cache folder in its slug.

Describe the solution you'd like
Is there a way to prevent the .yarn/cache folder from being included in the slug?

Describe alternatives you've considered
We opened a support ticket in Heroku. We tried adding .yarn/cache to our .slugignore file but this didn't work because the slugignore step happens before any yarn commands are run in the build logs. We were unable to resolve this.

Additional context
Our app uses React and Ruby on Rails. We are also not using Yarn's new Plug 'n' Play feature and still use node_modules.
Yarn version 3.6. Node version 16.20.0

Screenshots of file sizes from our staging w/Yarn v3 and production w/Yarn v1:
Screenshot 2023-06-28 at 5 17 37 PM
Screenshot 2023-06-28 at 5 18 01 PM

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions