Skip to content

Build hashes vary based on order of REACT_APP_ keys in process.env #12992

@jgregory-apogee

Description

@jgregory-apogee

Describe the bug

In some build environments (like Kubernetes), the order of the keys in process.env is non-deterministic. This can result in build outputs from the same source code and environment that have different hashes due to arbitrary variations in the order of the included REACT_APP_* variables.

Reproducible demo

See the repo at: https://github.com/apogee-stealth/cra-env-test

You can run the script test-env-order.sh in that repo to reproduce the issue.

The fix is simply to sort the REACT_APP_* keys before injecting them into the build. I will open a PR shortly with that change.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions