Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda