Qubical's avatar

NPM, Vite and Echarts.

Hi All, Trying to bundle the Echarts NPM package using Vite but not having any joy. I'm having to build a charting application for use offline using Sail and Laravel 10.

I'm using the package from Laravel Charts (https://charts.erik.cat/), config is set to use Echarts, and with the CDN in place, all is fine. However, trying to bundle the NPM package (installed) is causing me a headache.

Adding import * as echarts from 'echarts'; in app.js is not giving me any joy and my experience is limited.

Hoping there is a quick fix I've not been able to track down online.

Many thanks.

0 likes
3 replies
xandor's avatar

have you found any solution?

Qubical's avatar

@xandor Sorry, the project was a small demo and to get it working I switched to AmCharts5.

RemiM's avatar

The issue here is because you're using CDN resources while bundling everything with NPM and Vite. A solution would be to install the ECharts NPM packages like Chartjs and follow its usage instructions, eliminating the need to use the CDN dependencies.

1 like

Please or to participate in this conversation.