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

116
Visualizações
How to override maxSize/priority for chunk named in dynamic import

I have a chunk I'm naming in a dynamic import as follows:

const FileAttachments = React.lazy(() => import(
    /* webpackPrefetch: true */
    /* webpackMode: "lazy" */
    /* webpackChunkName: "file-icons" */
    "Widgets/FileAttachments"));

This is a large chunk and it's fine it if takes awhile to load (it's rarely used and has a perfectly sensible fallback) and similarly for social-icons. How do I specify the priority and override the default maxsize I've set in webpack config. I tried adding this

        cacheGroups: {
            'file-icons': {
                maxSize: Infinity,
                priority: -100,
            },
            'social-icons': {
                maxSize: Infinity,
                priority: -70,
            },
         }

But that actually caused me to no longer have a chunk with the name file-icons. Maybe that's expected because it was merged with another chunk but I don't really understand if I'm doing this right. Or do I have to use a regexp to specify a cacheGroup if I want to override the default options for a chunk (I was hoping to let webpack do it's think and split the chunks where it made sense while also lowering the priority and increasing the size maximum).

It's possible that this question doesn't even really make sense because, I admit, I don't have a good grip on how the cacheGroups and chunk names work and when I should name them etc.. etc..

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