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

185
Visualizações
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 Respostas
Responde à pergunta

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 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