evoker
Posts: 40
Joined: Tue Dec 01, 2020 1:01 pm

Reducing the highcharts and highcharts-more bundle

Hello!

I was wondering if it's possible to reduce the size of the highcharts and highcharts-more bundle, by excluding for example modules that aren't needed.

I've read that it's possible to build your own package, but I am not sure if that's sustainable.

Could anything be done via webpack perhaps?

I would really appreciate your guidance on the matter.

Thank you in advance!
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Reducing the highcharts and highcharts-more bundle

Hi there,

Good to hear from you!

The official way recommended by Highcharts team to reduce the package size (and build your own) is described here:
https://www.highcharts.com/docs/getting ... s-packages

Best regards!
Kamil Musiałowski
Highcharts Developer
evoker
Posts: 40
Joined: Tue Dec 01, 2020 1:01 pm

Re: Reducing the highcharts and highcharts-more bundle

Hi!

Thanks for the reply. Following the instructions in the guide, I generated a new custom file and then copied the es-modules folder into my Angular project.

Sadly I am getting a ton of errors about AnyRecord, DeepPartial as depicted below:

Image

Is the procedure different than the one described when importing the custom build into an Angular project?

Thanks in advance!
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Reducing the highcharts and highcharts-more bundle

Hello there,

I'm really sorry for the lack of response from my side.

In general, reducing the bundle size for Angular wrapper (and other ones) is completely fine. Since it looks like it is a TypeScript only error, I would recommend the following:
- always use the latest HC update, to have all of the fixes,
- take a look if declaring those missing TS type will help,

Code: Select all

declare global {
    type AnyRecord = Record<string, any>;
}
- check the latest bugfix for DTS which will be released in the next HC version (but is already merged with master so you can using if pulling files from GH repo)
https://github.com/highcharts/highcharts/pull/18057

And if none of the above steps work, please report it on our GitHub Issues page so the TypeScript dev team will have a deeper look into that.
https://github.com/highcharts/highchart ... new/choose

Thank you, and once again I'm sorry that you had to wait,
Best regards!
Kamil Musiałowski
Highcharts Developer
evoker
Posts: 40
Joined: Tue Dec 01, 2020 1:01 pm

Re: Reducing the highcharts and highcharts-more bundle

Thanks for the help! I was able to get it working as described.
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Reducing the highcharts and highcharts-more bundle

That's great to hear that! In case of any other questions, feel free to contact us anytime.
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Usage”