lugg / react-native-config

Bring some 12 factor love to your mobile apps!
MIT License
4.83k stars 656 forks source link

XCode does not pick up dotenv #703

Open focalsolution opened 2 years ago

focalsolution commented 2 years ago

Problems I want to run my application on XCode for debugging purposes. However, it looks like variables in dotenv configuration are not read into javascript.

Environment XCode 14.0.1 react-native 0.62.2 react-native-config 1.4.11

Files .env

BASE_URL="https://myservice.com/api"

javascript

import Config from 'react-native-config';
const baseURL = Config.BASE_URL;
console.log('baseURL: ', baseURL);

Reproduce Steps

  1. export ENVFILE=.env
  2. Open XCode
  3. Click Run
  4. baseURL always print out as undefined

I suspect that XCode might not aware of ENVFILE.

SanjanaTailor commented 2 years ago

Hello @focalsolution - I am also facing similar issue which returns the undefined value from .env file. similar issue while running android project.

Maxim-Filimonov commented 1 year ago

Same problem with Xcode 14 here. Wonder if it’s somehow broken on Xcode 14?

jonathanm-tkf commented 1 year ago

Same here!!!

ujosat commented 1 year ago

Please use 1.4.4 Version