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

68
Visualizações
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 à 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