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.
Describe the bug
In some build environments (like Kubernetes), the order of the keys in
process.envis 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 includedREACT_APP_*variables.Reproducible demo
See the repo at: https://github.com/apogee-stealth/cra-env-test
You can run the script
test-env-order.shin 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.