2022-06-09
2237
#react native
Chimezie Innocent
115257
Jun 9, 2022 â‹… 7 min read

Understanding React Native env variables

Chimezie Innocent I am Chimezie, a software developer based in Nigeria. I am highly skilled in HTML, CSS, and JS to build web-accessible and progressive apps. I'm also skilled with React for web, React Native for Android apps, and Tailwind CSS. I write technical articles, too.

Recent posts:

axios in javascript

Axios in JavaScript: How to make GET, POST, PUT and DELETE requests

Learn how to use Axios in JavaScript for GET, POST, PUT & DELETE requests. Examine setup, error handling, and API best practices.

Faraz Kelhini
Apr 1, 2025 â‹… 19 min read
how AI is shaping the future of 3D web development

How AI is shaping the future of 3D web development

AI for 3D web development is taking the internet by storm. Learn about this trend, the best tools for 3D web experiences, and how it’ll affect the development landscape moving forward.

Elijah Asaolu
Apr 1, 2025 â‹… 5 min read
docker exit code 1

How to troubleshoot exit code 1 in Docker

exit code 1 is one of the most common and frustrating errors for developers working in Docker. Explore what it means and how to fix it.

Ukeje Goodness
Apr 1, 2025 â‹… 4 min read
axios vs fetch 2025 update

Axios vs. Fetch (2025 update): Which should you use for HTTP requests?

Fetch() is native, but Axios is powerful. Which should you use in 2025? We compare features, error handling, and performance to help you decide.

Faraz Kelhini
Apr 1, 2025 â‹… 13 min read
View all posts

3 Replies to "Understanding React Native env variables"

  1. I followed the same steps, but i am getting this error: Unable to resolve “@env” from “App.tsx”

    Here is my babel.config.js:
    module.exports = function (api) {
    api.cache(true);
    return {
    presets: [“babel-preset-expo”],
    env: {
    production: {
    plugins: [“react-native-paper/babel”],
    },
    },
    plugins: [
    [
    “module:react-native-dotenv”,
    {
    envName: “APP_ENV”,
    moduleName: “@env”,
    path: “.env”,
    allowUndefined: true,
    },
    ],
    ],
    };
    };

    Not sure what is going wrong here, i tried adding a env.d.ts type declarations as well, but didn’t work. I am using react-native with Expo + typescript.

  2. Hi I’m the maintainer for react-native-dotenv. My recommendation is: only use react-native-dotenv as a devDependency

Leave a Reply