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

105
Visualizações
How should I load/bundle js libraries needed in 2 indipendent js ES modules?

Ok, I'm relatively new to js modules, I tried to find an answer to this question but till now I didn't. I was used to pack all the dependencies in one big js file, shared between several pages. I then loaded another page-specific js file after the shared 'bundle'.

all-pages: shared.js // browser-cached

page-1: page-1-specific.js, loaded after shared.js, uses libraries in shared.js
page-2: page-2-specific.js, loaded after shared.js, uses libraries in shared.js
etc..

Now with modules, if I try to pack several libraries this way, they won't be available to other js files, since anything inside a module can't be 'global' to the page. Ok.

So I should import dependency libraries on any page-specific js. But this way I would have libraries loaded in every page instead of taking advantage of broeser caching.

So what exactly is the way of doing this with es modules nowadays?

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