Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!