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

219
Views
Babel module resolution depending on environment variables?

Project Structure

├── project
│   └── operation
│       ├── index.minus.js
│       └── index.plus.js
│   └── index.js

project/operation/index.minus.js

export default (a, b) => (a - b);

project/operation/index.plus.js

export default (a, b) => (a + b);

project/index.js

import operation from './operation';

const result = operation(2, 3);

console.log(result);

Requirement

My requirement is to set an environment variable like OPERATION_NAME and based on its value (minus | plus) we have to import that particular index.${OPERATION_NAME}.js into the project/index.js file.

How to implement this functionality using babel or any other mechanisms?

about 4 years ago · Juan Pablo Isaza
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!