apexcharts / ng-apexcharts

ng-apexcharts is an implementation of apexcharts for angular. It comes with one simple component that enables you to use apexcharts in an angular project.
MIT License
318 stars 80 forks source link

Dynamically load apexcharts #26

Closed re-thc closed 4 years ago

re-thc commented 4 years ago

Hi, can the apexcharts js be dynamically / lazy loaded? It's a large file and not needed on all pages. Would be good if it can be loaded on demand just as required like a few other angular libs.

djabif commented 4 years ago

@hc-codersatlas I created a PR https://github.com/apexcharts/ng-apexcharts/pull/29 to solve this issue.

junedchhipa commented 4 years ago

Thanks @djabif

austenstone commented 3 years ago

I am loading the NgApexchartsModule in a lazy module but it still appears in the main bundle.

Is the idea that the apexcharts.js file should be in the lazy module?

image

exitlol commented 3 years ago

I am facing the same issue as @astone2014 does I am only importing the module, but my bundle contains the whole common.js. Is it because of the higher mentioned #29 MR? Since you import the whole thing it's gonna import everything from apexcharts w/o treeshaking unused stuff. How can we fix this issue? As you can see apexcharts is 25%!!!! of the whole bundle. It hurts on mobile especially. Képernyőkép 2021-04-08 142812

jinman commented 1 year ago

were you able to fix this this? or lazy load apex charts?