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

74
Vistas
Export entire library depend on env

Imagine I have some library called shared , shared have a lot of files inside , I want to divide this library on 2 different builds shared/es , shared/node . First one for browser use , second one for node use , and depend on enviroment I want to export different folder, lets see some example :

shared/index.js

if (process.env.SERVER) {require('shared/es')}
else {require('shared/node`)} 

and then I want to have opportunity to make exports from this shared/index.js file same I way as if I would make it from shared/es, I mean , imagine in root I have index.js file, and I want to import from shared some code

index.js

 import {isEmpty} from 'shared/utils/lodashAlternative'

and it will mean the same as shared/es/utils/lodashAlternative or shared/node/utils/lodashAlternative . Is it possible to make somehow ?

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