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

143
Vistas
Webpack, babel, corejs - generate unnecessary code

I would need to explain how to set up babel in combination with a webpack for transpiling and polyfilling JS. I also need to target the IE 11 browser.

Browserlist settings

"browserslist": [
    "defaults",
    "> 0.5%",
    "IE 11"
  ]

Babel settings

module.exports = {
  sourceType: "unambiguous",
  presets: [
    [
      "@babel/preset-env",
      {
        debug: true,
        useBuiltIns: "usage",
        corejs : {
          version : "3",
        }
      }
    ]
  ],
}

Webpack settings

// Path
const path = require("path");

module.exports = {
  mode: "production",
  context: path.resolve(__dirname, 'js'),
  entry: {
    'app': './app.js',
  },
  output: {
    path: path.resolve(__dirname, 'dist/'),
    filename: '[name].bundle.js',
  },
  module: {
    rules: [
      {
        test: /\.(js)$/,
        loader: "babel-loader",
        exclude: [
          /node_modules/,
        ]
      }
    ]
  },
  resolve: {
    extensions: [".js"],
    modules: [
      'node_modules',
    ],
  },
  optimization: {
    minimize: false
  }
};

app.js

const app = typeof undefined;

app1.bundle.js
npm run build - generate 2970 lines of code only for one line in app.js
91kb unminifed
26kb minifed
Screenshot

What am I doing wrong? Well thank you

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