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

186
Vistas
Adding parameters from npm build script to javascript app

I have an app that i want deployed on 3 different instances. Each has their own api url, logo, name, etcetera.

I will create a config file for each one that will determine the different information, whatever that may be.

Because i will build the app (vue/react/whatever), i can't use dotenv. I'd like to pass a parameter to the npm run build script that will be accessible within the javascript app so the app can select its config it was built for.

Any ideas, or alternatives to what i need to do? Just point me in the right direction.

Thank you very much in advance,

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Use for instance

env INSTANCE=1 npm run build

Then you can get the instance number/name in your js configs with process.env.INSTANCE.

At build time your bundler will substitute that with the actual value you've defined.

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