Is it possible using React Antd charts in .js files instead of .ts files? (Attempted import error: '__spreadArray' is not exported from 'tslib'.)

Viewed 1542

It is totally ok to use ant charts in .ts file without errors but when I changed the file to .js file there is an error :

./node_modules/@antv/algorithm/es/gaddi.js
Attempted import error: '__spreadArray' is not exported from 'tslib'.

I assume the reason of the error is that .js extension. How can I use antd charts in javascript files instead of typescript files/how to resolve this error?

npm package is : https://www.npmjs.com/package/@ant-design/charts

1 Answers

I resolved it now, by installing tslib package :

npm install tslib

Error is gone now.

Related