P粉7482188462023-08-31 09:09:45
You cannot access process.env
from client side JavaScript (browser) in which case it is react. Therefore, even if the container has that environment variable, JavaScript cannot access it.
The way React uses env variables is that React reads them from the .env
file, and then in the build React takes those variables and persists them as JavaScript code.
In your case the image (react app) is already built so it can't Access those environment variables in the container..