Build hashes vary based on order of REACT_APP_ keys in process.env
Created by: 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.