IE11 SCRIPT1002 syntax error with => in main.js babel and webpack

Viewed 4581

I am getting error SCRIPT1002 syntax error in IE11 with ES6 and Babel.

I found that it is due to arrow function => in my typescript code.

I am using

  • Vue
  • webpack: "^4.20.2",
  • @babel/core: "^7.1.2"`

I've tried following .babelrc

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "modules": false,
        "targets": {
          "browsers": [ "> 1%", "last 2 versions", "not ie <= 8" ]
        },
        "useBuiltIns": false
      }
    ]
  ]
}
1 Answers

Try to add transform-es2015-arrow-functions babel plugin. If you will still experience similar errors - try to analyze the code of your bundle and find which ES6 feature not supported by IE11 remain there and add plugins for them.

Related