Actually, I am trying to set the REACT_APP_DEPLOY_DOMAIN variable automatically in .env file.
below is one method I tried to achieve the solution to this issue.
below is my script file in which I am getting my IP address
const os = require("os");
const networkInterfaces = os.networkInterfaces();
const ip = networkInterfaces["Wi-Fi"][1]["address"];
REACT_APP_DEPLOY_DOMAIN = `http://${ip}`;
console.log(`http://${ip}`);
return `http://${ip}`;
below is the env variable in .env file
REACT_APP_DEPLOY_DOMAIN = http://192.168.1.114
And also I tried to update it from the start command but it is setting it as the exact command
"start": "set REACT_APP_DEPLOY_DOMAIN=node ./src/components/getIp.js && react-scripts start",
And also my script file is not running when I try to run the below command.
"start": "node ./src/components/getIp.js && react-scripts start",
Update the start command to this, it works on Linux/Mac. Hopefully, it'll also work on windows
"start": "set REACT_APP_DEPLOY_DOMAIN=$(node ./src/components/getIp.js) && react-scripts start",