Everything was running smoothly in my existing Vue project until we decided to optimize the bundle size by implementing lazy loading routes.
For example:
const ContentAuditPage = () => import("./components/content-audit/ContentAuditPage");
However, after this optimization, I encountered an error with Fusion Chart. The chart is supposed to display data in a sidebar when the endpoint data is ready, but instead, I received this error:
https://localhost:3000/v2/108967/content/audit/fusioncharts.charts.js net::ERR_ABORTED 404 (Not Found)
This was followed by:
fusioncharts.js:13 Uncaught (in promise) Error: ChunkLoadError
at a.e (fusioncharts.js:13:2209)
at d (fusioncharts.js:13:57828)
at Function.<anonymous> (fusioncharts.js:13:59295)
at i (fusioncharts.js:13:177902)
at o (fusioncharts.js:13:178077)
at h (fusioncharts.js:13:179357)
at t.chartType (fusioncharts.js:13:84493)
at new e (fusioncharts.js:13:76516)
at new f (fusioncharts.js:13:61265)
at VueComponent.renderChart (index.js:17918:1)
at fusioncharts.js:13:72261
In my Vue project, I imported Fusion Charts like this:
import FusionCharts from 'fusioncharts';
import Exports from 'fusioncharts/fusioncharts.excelexport';
import TimeSeries from 'fusioncharts/fusioncharts.timeseries';
const vueFusionCharts = VueFusionChartsComponent(FusionCharts, Exports, TimeSeries);
FusionCharts.options['license']({
key: process.env.FUSIONCHARTS_KEY,
creditLabel: false,
});