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

147
Vistas
Module aggregation in JavaScript evaluates all exports

I have the following JS file structure:

module1.js

console.log('Hello 1')
export const func1 = () => { }

module2.js

console.log('Hello 2')
export const func2 = () => { }

index.js

export * from 'module1'
export * from 'module2'

app.js

import {func1} from 'index'

func1()

In the console I can see both Hello 1 and Hello 2 logged. Is this intended behaviour? Will all modules be evaluated each time I import a single function from an aggregated module? And does it mean that if I want to optimize my code, I will always need to do as below?

import {func1} from 'module1'
import {func2} from 'module2'
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