vutran6853 / vue3-chart-v2

vue3-chart-v2 is a wrapper for Chart.js in vue 3. You can easily create reuseable chart components. Inspired by vue-chartjs
https://vue3-chart-v2.netlify.app/
38 stars 30 forks source link

Type error when building for production #11

Open kabugh opened 3 years ago

kabugh commented 3 years ago

Hey, thanks for this awesome library!

I used the last example from docs: Chart with dynamic I found a bug, as shown on the screenshot below, which disables me from using the lib at all. When I run npm run build, the package is not built because of the type error.

I think the problem is the way Chart is imported in BaseChart.tsx. So I found a solution to this bug, but it doesn't solve the problem completely. According to docs, Chart.js should be imported like this:

import { Chart, registerables } from 'chart.js';
Chart.register(...registerables);

https://www.chartjs.org/docs/next/getting-started/integration.html

The caveat is that it breaks the custom chartOptions later used in the chart component. It applies default Chart.js options instead. Is there any way we could solve the type issue in BaseChart.tsx or is this something else?

bug