Currently, I am attempting to integrate Highcharts with some of its extensions, such as "highcharts-more," into a project that utilizes webpack, TypeScript, and AngularJS (version 1.5).
I have successfully installed Highcharts via npm (https://www.npmjs.com/package/highcharts). However, I am encountering difficulties when trying to import the bundled extensions.
My current solution involves setting global variables in the webpack configuration file:
plugins: [
new webpack.ProvidePlugin({
Highcharts: 'highcharts',
HighchartsMore: 'highcharts/highcharts-more',
HighchartsExporting: 'highcharts/modules/exporting'
})
]
and manually extending Highcharts:
HighchartsMore(Highcharts);
HighchartsExporting(Highcharts);
without any direct imports. Unfortunately, TypeScript is throwing errors due to this workaround:
error TS2304: Cannot find name 'HighchartsMore'
error TS2304: Cannot find name 'HighchartsExporting'
Interestingly, there are no issues with importing just Highcharts itself using:
import * as Highcharts from 'highcharts';
As an alternative, I would prefer to cleanly import each module separately, for example:
import {HighchartsMore} from 'highcharts-more';
Any suggestions or insights on how to achieve this would be greatly appreciated.