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

272
Vistas
Can reduce the dependence on core-js for dynamic import webpack?

What is the point - I use Babel and core-js for polyfill and here when using the loading of the dynamic module to reduce the size of the code and of course not to load on the page of what is not necessary, I faced that core-js on generated 4336 lines code for a script of 12 lines of code:

import isMobile from 'is-mobile';

document.addEventListener('DOMContentLoaded', function () {
    if (isMobile() === true) {
        import('./module/mobilemenu').then(function ({default: init}) {
            const menu = document.querySelector('.mobile-menu');

            init(menu, document.body);
        });
    }
});

Judging by the Babel documentation for the corresponding plugin (@babel/plugin-syntax-dynamic-import) combined with the parameter in the configuration babel.confi.js useBuiltIns: 'usage' it loads these modules from core-js:

import "core-js/modules/es6.promise";
import "core-js/modules/es6.array.iterator";

Is it possible to somehow optimize this file size, maybe core-js uses modules that are not used for the code above and they could be ignored IgnotePlugin?

I understand that support for old standards inflates the source code, but in this case the code from webpack without a preprocessor takes 400 and with Babel 10 times more, and I do not really like it :(

So maybe someone was trying to figure out what is the reason for the cumbersome file and whether it can be somehow shortened.

Babel: enter image description here

Clean: enter image description here

If you need more information, write in the comments, also open to criticism if I'm doing something wrong here ((

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