首页 > 解决方案 > 如何使用 Webpacker 在 JS 项目中使用 TypeScript 包

问题描述

最近需要添加一个TypeScript包,编译报错:


ERROR in ./app/javascript/packs/src/Chart.jsx 356:43-57
export 'ElderRaySeries' (imported as 'ElderRaySeries') was not found in 'react-financial-charts' (possible exports: defaultScaleProvider)

ERROR in ./app/javascript/packs/src/Chart.jsx 364:43-61
export 'SingleValueTooltip' (imported as 'SingleValueTooltip') was not found in 'react-financial-charts' (possible exports: defaultScaleProvider)

ERROR in ./app/javascript/packs/src/Chart.jsx 377:44-59
export 'CrossHairCursor' (imported as 'CrossHairCursor') was not found in 'react-financial-charts' (possible exports: defaultScaleProvider)

ERROR in ./app/javascript/packs/src/Chart.jsx 391:30-38
export 'withSize' (imported as 'withSize') was not found in 'react-financial-charts' (possible exports: defaultScaleProvider)

ERROR in ./app/javascript/packs/src/Chart.jsx 395:3-18
export 'withDeviceRatio' (imported as 'withDeviceRatio') was not found in 'react-financial-charts' (possible exports: defaultScaleProvider)

看起来我需要更改我的 webpack 配置以允许转换该包。

我发现很难找到这方面的任何信息,我该怎么做?

标签: ruby-on-railstypescriptwebpacker

解决方案


推荐阅读