Topic: Removing Chart.js?

maenthoven pro asked 6 years ago


How do I remove chart.js as a dependency? I'm not using it anywhere in my application, and I'm not importing any modules that are using it, either.

As a bundle, it's 40kb of complete bloat when gzipped.


Damian Gemza staff answered 5 years ago


Dear @maenthoven

You're able to do that. Just don't import the ChartsModule in your application, and you're able to safely remove the Chart.js dependency from your project.

If after removing Charts.js compiler will throw you some errors about charts is necessary, please update the MDB Angular to the latest version.

Best Regards,

Damian


maenthoven pro answered 5 years ago


Damian,

I want to remove chart.js as a build dependency given that I am not using it.

Angular Universal bundles this together with my app, which adds to the size of the bundles


Damian Gemza staff answered 5 years ago


Dear @maenthoven

Could you please describe, which is not working correctly while using Chart.js on Angular Universal? I would like to debug this problem.

Please provide me the every needed information - how to reproduce, what's the actual behavior, which behavior should be correct.

Best Regards,

Damian


maenthoven pro answered 5 years ago


Has this been fixed yet?


Arkadiusz Idzikowski staff answered 6 years ago


Dear maenthoven,

We will try to fix it as soon as possible, but unfortunately, I can't give you an ETA yet.

Regards,

Arek


maenthoven pro answered 6 years ago


For anyone following, my previous post/workaround did not work for server side rendering / angular universal.


maenthoven pro answered 6 years ago


Nevermind. Does not work.


Arkadiusz Idzikowski staff answered 6 years ago


Dear maenthoven,

Removing chart.js can cause problems in production mode. We need to fix something on our end to resolve this problem.

Regards,

Arek


maenthoven pro commented 6 years ago

Ok. How long will this take?

I'd like to ship this application and get it in front of hundreds of thousands of people... but the bundle is just way too large right now. 300kb while gzipped, and it looks like it's mostly your modules:

https://imgur.com/a/4mbS290

I followed the angular universal guide. How do I get this down?

Your installation alone is over 100kb while Gzipped...

Additionally, chart.js has a dependency on moment, another massive library I don't need.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 7.0.0
  • Device: All
  • Browser: All
  • OS: All
  • Provided sample code: No
  • Provided link: No