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

108
Vistas
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 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