I create one .json file in various development / staging / production server which looks like below.
{
"host": "local OR staging OR production";
}
Then in code.
const env = require('./env.json') || {"host": "local"};
And use env.host everywhere. I don't create a .json file in the local system.
No dependency on module or process. Give it a shot. It works for me