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

67
Views
Multiple platform specific builds for single react app

I want to develop a react js application that has specific platform code (Electron, Browser, Ionic).

First I made a library that wraps the platform-specific API in one interface like storage for example. I made a StorageInterface and a Storage class that implements the StorageInterface then I have StorageElectron class which inherits the Storage class same goes for BrowserStorage and IonicStorage. Now in my react app I just initiate the Service but I want to change it in build time.

Let's say I have this line of code let storageService: StorageInterface = new Storage(). When I enter npm build electron it builds with the StorageElectron class and when I enter npm build web it builds with the StorageWeb class instead of StorageElectron. The Storage class is just for the OOP norm it has only the headers of the methods but does not implement the functionalities.

I don't know if it's possible like this.

What I thought so far :

1- Create a Webpackloader or a precompiler that changes some lines of code in some files.

2- Create a precompiler using TypeScript decorators.

3- Create a simple script that changes the files that contain these calls before they react script.

I just want to know if there is a tool or a library able to do that.

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!