Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #6846
Closed
Open
Issue created Apr 19, 2019 by Administrator@rootContributor

babel-loader cacheCompression setting

Created by: jleclanche

cacheCompression is an enabled-by-default flag in babel-loader, which gzips the babel-loader cache. The cache in question in CRA can be found in node_modules/.cache/babel-loader and consists of json files that are mainly composed of jsonified source files.

The setting was introduced in the CRA webpack configuration in commit 74c4baeb (PR #5053, cc @Timer). Since that PR, the webpack config has been merged into one file and cacheCompression is set to true if NODE_ENV is production, false otherwise.

A couple of thoughts here:

  1. Having it disabled in dev and enabled in prod means caching won't be shared between dev and prod. If a dev and prod build happens on the same machine (not unlikely), this actually increases disk space usage.
  2. A cursory look at a few of my react projects tell me that the space savings are inconsistent at best. My largest project shaves off ~35%; it's lots and lots of tiny little files: the cached chunks are very small (usually referencing single components) and don't benefit from what you'd intuitively think would compress very well if it were all in one file.
  3. Most projects do not actually benefit from cache compression at all, especially in production with builds most often happening in a CI environment, where memory is precious and disk space inexpensive.

So in general I actually disagree with babel-loader's enabled-by-default cacheCompression and I think more people will want it off than on. Thoughts on disabling it in CRA?

Assignee
Assign to
Time tracking