Skip to content
This repository was archived by the owner on Jul 8, 2020. It is now read-only.

Commit 2754376

Browse files
authored
Update README.md
1 parent cdf2d95 commit 2754376

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

README.md

+19-7
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ Let you `import` environment variables from a **.env** file in React Native, **d
1212
$ npm install react-native-dotenv --save-dev
1313
```
1414

15-
If you haven't got **.babelrc** set up for React Native, run
16-
17-
```sh
18-
$ npm install babel-preset-react-native --save-dev
19-
```
20-
21-
And create a file named **.babelrc** as follow in the project root.
15+
Add the `react-native-dotenv` preset to your **.babelrc** file at the project root.
2216

2317
```json
2418
{
2519
"presets": ["react-native", "react-native-dotenv"]
2620
}
2721
```
2822

23+
If you haven't got **.babelrc** set up for React Native, remember to install `babel-preset-react-native` first.
24+
25+
```sh
26+
$ npm install babel-preset-react-native --save-dev
27+
```
28+
2929
## Usage
3030

3131
Add your app configuration in an **.env** file.
@@ -54,6 +54,18 @@ The example above will get compiled as below.
5454
ApiClient.init('lorem', 'foobar')
5555
```
5656

57+
## Can I use different **.env** settings for production ?
58+
59+
Yes, simply create a separate **.env.production** file and the default release process of react-native will pickup the right config.
60+
61+
To test it locally, you can use the **Release** configuration to launch the Simulator / Emulator.
62+
63+
### iOS
64+
`react-native run-ios --configuration Release`
65+
66+
### Android
67+
`react-native run-android --configuration Release`
68+
5769
## Benefits we got
5870

5971
* It could find out error like importing an non-existing variable.

0 commit comments

Comments
 (0)