You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppress the stderr inject message (`◇ injected env (N) from .env`).
231
+
232
+
```json
233
+
{
234
+
"plugins": [
235
+
["module:react-native-dotenv", {
236
+
"quiet": true
237
+
}]
238
+
]
239
+
}
240
+
```
241
+
219
242
</details>
220
243
<details><summary>process.env</summary><br>
221
244
@@ -233,9 +256,37 @@ For host/CI-only values, use `@env` imports — or put the key in `.env` and let
233
256
</details>
234
257
<details><summary>Expo</summary><br>
235
258
236
-
Expo now has [built-in environment variable support](https://docs.expo.dev/guides/environment-variables/). Evaluate if you still need this plugin.
259
+
Expo has [built-in environment variable support](https://docs.expo.dev/guides/environment-variables/). Use this plugin when you want `@env` imports or multi-env files (e.g. `.env.staging` via `APP_ENV`).
260
+
261
+
```js
262
+
// babel.config.js
263
+
module.exports=function (api) {
264
+
api.cache(false)
265
+
return {
266
+
presets: ['babel-preset-expo'],
267
+
plugins: [
268
+
['module:react-native-dotenv']
269
+
]
270
+
}
271
+
}
272
+
```
273
+
274
+
```ini
275
+
# .env
276
+
HELLO="Universe"
277
+
```
278
+
279
+
```js
280
+
// app/index.tsx
281
+
import { HELLO } from'@env'
282
+
import { Text } from'react-native'
283
+
284
+
exportdefaultfunctionHomeScreen() {
285
+
return<Text>Hello {HELLO}</Text>
286
+
}
287
+
```
237
288
238
-
Preview [the expo test app](https://github.com/goatandsheep/react-native-dotenv-expo-test).
289
+
Then start with a clean Metro cache: `npx expo start --clear`.
0 commit comments