Reputation: 11
In my React project, I want to change the api addresses after build it. I want to be able to change their address dynamically. is There a way I can do this? I do not want to use the environment. Because when I get build, I can not change api address
Upvotes: 0
Views: 123
Reputation: 4332
Use the NODE_ENV env variable to check the environment
if (process.env.NODE_ENV === 'production') {
// Set the API URL for prod
}
Set NODE_ENV=production
when running your build script
Upvotes: 1