Configuring environment for React app

Hello, I have react app application and would like to use Sentry. We have three environments (local, dev, prod) and I need to change Sentry environment configuration after the app is built and before it’s deployed.
One way is to do a search & replace in “compiled” .js files, however, this option is really bad.
What is the recommended setup?

Thank you

Okay, I have figured it out using window.env
window.env = {