Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

191
Visualizações
npm run demo doesn't pointing to demo

I have two different environments with named .env.development, .env.production, and common .env also.

.env.development looks like this,

TEST_LABEL=Development

.env.production looks like this,

TEST_LABEL=Production

.env looks like this,

TEST_LABEL=ENV

And here is my babel.config.js,

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['module:metro-react-native-babel-preset'],
    plugins: [
      ["module:react-native-dotenv",
        {
          "moduleName": "@env"
        },]
    ]
  };
};

this is the scripts in package.json

"scripts": {
    "start": "react-native start",
    "development": "NODE_ENV=development expo start",
    "production": "NODE_ENV=production expo start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "test": "jest"
},

And this is how I used it in my Homescreen.js

import {TEST_LABEL} from "@env"
...
<Text>{TEST_LABEL}</Text>

And this displays always Development even I run the production env

I run the app like npm run development for development environment, npm run production for production environment.

I am using react-native-dotenv

Here is the Project structure snapshot,

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I found this issue and it says the only supported envs are development, production, and test. If you want to use other env names you can use the experimental feature APP_ENV

    "demo": "APP_ENV=demo expo start",
    "local": "APP_ENV=local expo start",

and I think .local files are loaded by default

UDPATE

I tested your config and it looks like this issue is the reason the value is not updating, adding -c to your commands clears the cache and load the correct env values

    "development": "NODE_ENV=development expo start -c",
    "production": "NODE_ENV=production expo start -c",
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda