I just upgraded chart.js at v4.1 and react-chartjs-2 at v5.1, in order to use react 18, in my components library. After I installed my version which includes the updated packages, I get the following error: TypeError: Cannot read properties of undefined (reading 'register').
Do you have any idea why this is happening? Before the upgrade, everything worked and also, in my components library, I have some examples using Chart components that are working as expected. Thanks!
ErrorImage
This is my code:
import { Chart as BaseChart } from 'react-chartjs-2'
import { Chart as ChartJS } from 'chart.js/auto'
import { CategoryScale, LinearScale, PointElement, LineElement, BarElement } from 'chart.js'
ChartJS.register(CategoryScale, LinearScale, PointElement, LineElement, BarElement)