1

I'm facing an issue in loading an integrated amchart with typescript app in IE 11.

App node module versions

"@types/node": "^10.9.4",

"typescript": "2.9.1",

"@amcharts/amcharts4": "^4.10.13",

"babel-core": "^6.26.3",

"babel-loader": "^7.1.5",

I'm getting the following error when executing this line of code in IE 11.

const chart = am4core.create("chartdiv", am4maps.MapChart);

The error is

**SCRIPT1002 : syntax error**

I have tried adding support to arrow function as the error is happening for arrow function

/* harmony default export */ __webpack_exports__["default"] = (function(f) {
  let delta = f;
  let compare = f;

  if (f.length === 1) {
    delta = (d, x) => f(d) - x; // Error Here
    compare = ascendingComparator(f);
  }
})

I've tried

  1. installing @babel/plugin-transform-arrow-functions and specifying it as a plugin in babelrc.
  2. In tsconfig.json changed the target to es5
  3. Imported the necessary polyfills in polyfills.ts file
  4. added rules to support in webpack.config

Also most of the solutions in stackoverflow I tried. But still this error is not resolved . Could you please help me on this

5
  • Did you try to add the core-js polyfill? If not, I suggest you add it by running the npm install core-js @types/core-js regenerator-runtime command and try to add import "core-js/stable"; at the top of the TypeScript / JavaScript code. This must be put before everything else, or it won't work! Please see Polyfill for older browsers. Commented Mar 5, 2021 at 3:17
  • Tried this. But not working
    – Dileep TP
    Commented Mar 5, 2021 at 5:27
  • Does it show any other error after adding the core-js polyfill? If yes, please inform us about it. Are you trying to use Force Directed Tree plugin? If yes, it is not supported in the IE browser. Commented Mar 8, 2021 at 7:56
  • It doesn't show core-js error because I exluded it from compiling with babel. At present I'm using only geographical map
    – Dileep TP
    Commented Mar 8, 2021 at 9:50
  • Just for testing purposes, can you try to remove other polyfills and only add the core-js polyfill? To see whether it makes any difference. Commented Mar 10, 2021 at 8:47

1 Answer 1

0

I have the same problem, You need to install this version

npm i @amcharts/[email protected]

https://www.npmjs.com/package/@amcharts/amcharts4/v/4.3.5

this version works for me

Not the answer you're looking for? Browse other questions tagged or ask your own question.