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

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