Reputation: 125
I am a React beginner. Develop with React, build and deploy to the server. When deploying, use'yarn run build' to upload the resulting file to the server apache. During development, the address of the API server was set in the .env file. After building and deploying, I want to change the API server address in the .env file. But there is no .env file in the built file...
It seems that the value of the .env file cannot be modified. In this case, is there a way to change the setting value without build even after deployment?
Upvotes: 0
Views: 937
Reputation: 954
You need to create two env files .env.development and .env.production under root path and whatever you define in .env.development will work for local and whatever you define inside .env.production will work when you create build that is it is being switched to production mode
Upvotes: 1