Why can Vue's webpack template use ES6+ methods such as assign on IE browsers without using polyfill?

  1. Why Vue"s Webpack template does not use polyfill can also use ES6+ methods such as Object.assign on IE browsers. And there is no babel-polyfill in the package.json and related configuration of the template
  2. can"t babel-loader automatically add relevant polyfill based on ES6 usage in my code? I feel that using my configuration is based on the polyfill added by browserlist
  3. when I use Webpack4 myself, I need to use the ES6+ method correctly on my IE browser. You need to add a line import "babel-polyfill" to the entry file.

attach my webpack configuration:

"use strict";
const path = require("path");
module.exports = {
  mode: "development",
  entry: {
    index: path.join(__dirname, "./index.js"),
  },
  output: {
    filename: "[name].bundle.js",
  },
  devtool: "cheap-module-eval-source-map",
  devServer: {
    contentBase: path.resolve(__dirname, "./"),
    port: 8000,
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            cacheDirectory: true,
            presets: [[ "env", {
              useBuiltIns: true,
            }]],
            plugins: [ "transform-runtime" ],
          },
        },
      },
    ],
  },
};


babel only transforms syntax, but no api, new api needs to introduce babel-polyfill


  1. Object.assign does not require babel-polyfill
  2. babel can do this. But the question is, do you need to convert? If only your target browser is the latest browser, is it not necessary to convert it?
Menu