vue3-apexcharts icon indicating copy to clipboard operation
vue3-apexcharts copied to clipboard

Reduce bundle size?

Open entity opened this issue 3 years ago • 3 comments

Hey,

Is it possible to reduce the bundle size for the Vue 3 ApexCharts wrapper?

entity avatar Jun 29 '22 20:06 entity

I have been having similar issue and I still can't figure a way to do this. The bundle size is too large, there should be a way we can load the chart modules separately like the way we do in lodash as an example. The bundle size is really affecting performance in production

Aubynj avatar Aug 18 '22 09:08 Aubynj

would be great if we could only import what we need.

gaby64 avatar Sep 02 '22 20:09 gaby64

There won't be a way to achieve this without some significant refactoring of the underlying apexcharts package. Unlike other chart libraries, this one uses OOP with an entry/main class that then dynamically calls the chart based on a type passed at runtime.

This means that treeshaking can't work because there's no way for the bundler to know what type of chart might be called.

They'd need to do away with that entry class and refactor it completely into ES6 modules which then call further ES6 modules that are depended on, then your bundle could be like "Oh, they used import { BarChart } from "apexcharts";, therefore I only need the modules imported by BarChart".

In short, it's a hell of a lot of work.

craigrileyuk avatar Jun 11 '23 16:06 craigrileyuk