Chartjs-Chart.JS reduce bundle size using specific charts

0๐Ÿ‘

I had done it using react-chartjs-2 with great documentation. If anyone also wants to use it, here are the examples.

Thanks to this article 4 Ways to Shrink Your Javascript Bundle by 50%, using the step #4.

0๐Ÿ‘

You can import this away:

  import {
    Chart,
    LineController,
    LineElement,
    LinearScale,
    CategoryScale,
    PointElement,
  } from "chart.js";
  Chart.register(
    LineController,
    LineElement,
    LinearScale,
    CategoryScale,
    PointElement
  );

I had already answered this issue on github

https://github.com/chartjs/Chart.js/issues/11247

Leave a comment