我有一个现有的项目 vue,在这种情况下一切都运行良好。
我们决定优化应用程序的包大小,因为它太大并实现了延迟加载路线,
例如
const ContentAuditPage = () => import("./components/content-audit/ContentAuditPage");
之后我注意到融合图抛出了错误,
图表位于侧边栏中,当打开侧边栏并且来自端点的数据准备好显示时,会抛出此错误
https://localhost:3000/v2/108967/content/audit/fusioncharts.charts.js net::ERR_ABORTED 404 (Not Found)
还有这个之后
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
在我的 vue 项目中它是这样导入的
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,
});```
我通过导入这个解决了这个问题
import Charts from 'fusioncharts/fusioncharts.charts'
并将其添加到此处
const vueFusionCharts = VueFusionChartsComponent(FusionCharts, Exports, TimeSeries, Charts);