Skip to content

Add readonly mode for filesystem cache #13581

@SkReD

Description

@SkReD

Feature request

Add readonly mode for filesystem cache to outcome shared cache missing limitation

What is the expected behavior?

It should be possible to use already existing cache without tackling problems of concurrent write access, handling unused entries and managing uncontrolled grow of cache.

What is motivation or use case for adding/changing the behavior?

This will allow reuse at least common node_modules cached entries when running multiple compilations in parallel.

To clarify situation, where it's need:

  1. Project is monorepo with several (or more) packages where every one of them is compiled to single js file. Packages are quite big (result file is about 1-2 Mb). node_modules are hoisted to root and can be effectivly cached between all packages.
  2. Build is almost always production and not in watch mode.
  3. We need to somehow reduce compilation time of all packages. Especially in CI.
  4. Separate cache for every package is not efficient in terms of time: in CI it's not helping and memory: we have server and client builds and cache for them is about 100 Mb for one package
  5. Multiple entries not share they memory cache (at least that what it's looks like when i try that) and even result to build hang.

So this solution looks pretty light and bring our build with webpack 5 to be at least not slower than with webpack 4, which, in turns, will allow us to move to webpack 5.

How should this be implemented in your opinion?

Flag cache.readonly in config, which is disable cache store in store method of PackFileCacheStrategy

Are you willing to work on this yourself?
yes

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions