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

104
Vistas
re-exporting module evaluates module even though export is not used

In a large typescript react app with webpack we have a common module with a bunch of utilities, classes, types etc. This module is set up with an index file that re-exports all the individual modules. Like so

export * from './a';
export * from './b';
export * from './c';
...

Some of these individual modules a also use a similar index file to re-export stuff, so the export tree is several layers deep. It probably involves thousands of exported items.

The issue is that when a simple function is imported from this common ui module it evaluates ALL the individual modules as well. Some of these individual modules for example have exports with expensive constructors export const classA = new ClassA().

This common module is deeply ingrained through multiple apps that are quite large (think hundreds of thousands lines of code). Each individual file in our apps maybe imports at most 3 or 4 items from this common module.

Is there a way to clean this up so it is less wasteful without refactoring all the applications? Preferably without having to update all our individual import statements throughout all applications.

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