I've been experimenting with ChartJS (NOT vue-chartjs) and everything was running smoothly until I encountered a sudden error. Here is the snippet of code:
import Chart from 'chart.js'
export default defineComponent({
setup() {
const optionsSubMenu = computed(() => {
return [
{
to: `/expenses/history`,
title: 'History'
},
{
title: 'Payables'
},
{
title: 'Receivers'
}
]
})
onMounted(() => {
const ctx = document.getElementById('expenses-chart') as HTMLCanvasElement
const canv = ctx.getContext('2')
THE ERROR POINTS TO THIS "new Chart"
new Chart(canv, {
type: 'bar',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
datasets: [
{
label: 'Category 1',
type: 'bar',
data: [5008, 23873, 32122, 16322, 8033, 43381, 12562],
backgroundColor: '#b7b7b7',
borderColor: '#b7b7b7',
barThickness: 30
}
]
}
}
})
})
When inspecting my devtools, the following error message appeared:
**SyntaxError: The requested module '/node_modules/.vite/chart_js.js?v=b552445d' does not provide an export named 'default'**
Does anyone have insights into why this issue is occurring?