(refactor) load chart.js dynamically on demand

This commit is contained in:
Valentyne Stigloher 2025-01-12 14:19:53 +01:00
parent e69eff7104
commit 8d17028dc2

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import Chart, { type ChartDataset, type ChartOptions, type ChartType } from 'chart.js/auto';
import type { ChartDataset, ChartOptions, ChartType } from 'chart.js';
const COLOURS = [
'#C71585',
@ -60,6 +60,7 @@ const drawChart = async () => {
}
let colourIndex = 0;
const { default: Chart } = await import('chart.js/auto');
new Chart(canvas.value, {
type: props.type,
data: {