Skip to content

Support for changing the cache location #11263

Open
@dhess

Description

@dhess

Is your proposal related to a problem?

When using create-react-app with Nix-based packagers such as https://github.com/tweag/npmlock2nix, usually these packagers will, by default, createnode_modules as a symlink to the Nix store, which is read-only. Because npm run build tries to write node_modules/.cache, these tools are incompatible with create-react-app (or, more specifically, react-scripts) without some workarounds.

Describe the solution you'd like

I would like to be able to override the create-react-app cache location — for example, to be able to set it to <PROJECT_ROOT>/.cache.

Describe alternatives you've considered

At least some of these Nix-based packagers support copying the Nix store node_modules contents to the project root directory, rather than symlinking it. This works fine, but is a pain to manage, and it's easy to get something wrong; e.g., to have a stale node_modules around after adding, removing, or updating a dependency. The aforementioned https://github.com/tweag/npmlock2nix project takes pains to recreate the node_modules symlink when a dependency is changed, but not a copied node_modules subdirectory.

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