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

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

在.ts文件中使用ant图表完全没问题,但是当我将文件更改为.js文件时出现错误:

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

我假设错误的原因是 .js 扩展名。我如何在 javascript 文件中使用 antd 图表而不是 typescript files/how 来解决这个错误?

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

我现在通过安装 tslib 包解决了它:

npm install tslib

现在错误消失了。