javascript – Object does not support property or method "assign" in IE11

Question:

Configured webpack + babel as follows

webpack.config.js

...
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        loader: 'babel-loader'
      },
...

.babelrc

{
  "plugins": ["lodash", "transform-object-rest-spread"],
  "presets": [
    ["env", {
      "targets": [
        "> 4%",
        "ie 11",
        "safari 8"
      ]
    }],
    "react",
    "react-optimize"
  ],
  "env": {
    "test": {
      "presets": ["es2015", "react"]
    }
  }
}

I run it in chrom, everything is ok, in IE 11 it gives an error

Object does not support property or method "assign"

Answer:

npm install --save-dev babel-plugin-transform-object-assign

.babelrc

{
  "plugins": ["transform-object-assign"]
}
Scroll to Top
AllEscort