Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!