I have a React app which is built inside a Docker container when deployed. It all works as it should, no issues. I have an .env file for development with an API_URL variable and an .env.prod file for deployment with a different API_URL. The .env files get passed directly inside the start/build scripts, like this (for yarn start):
"start": "cross-env NODE_ENV=development env-cmd .env node server"
So, the API_URL variable is inside the .env file used in this script. My question is - can I somehow pass the variable to yarn start or yarn build? When I tried, for testing, adding the variable directly in the script, it didn't get picked up, like so: "start": "cross-env NODE_ENV=development API_URL="my api url" env-cmd .env node server".