reactchartjs/react-chartjs-2

[Bug]: TypeError: Cannot read properties of undefined (reading '_adapters')

mattgatee opened this issue · 2 comments

Would you like to work on a fix?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

I've been avoiding using the time scale for a while now, and it looks like I have no choice but to confront this error:

build.js:37244 Uncaught TypeError: Cannot read properties of undefined (reading '_adapters')
    at eval (chartjs-adapter-date-fns.min.js:7:492)
    at eval (chartjs-adapter-date-fns.min.js:7:16)
    at eval (chartjs-adapter-date-fns.min.js:7:257)
    at ./node_modules/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.min.js (build.js:36772:1)
    at __webpack_require__ (build.js:37241:33)
    at fn (build.js:37504:21)
    at eval (Line.tsx:19:1)
    at ./src/components/prices/line/Line.tsx (build.js:33971:1)
    at __webpack_require__ (build.js:37241:33)
    at fn (build.js:37504:21)

I've tried:

https://stackoverflow.com/questions/67017539/timeseries-scale-in-chartjs-3-0-2-brings-error-this-method-is-not-implemented
https://stackoverflow.com/questions/70777779/time-series-line-chart-js-in-react-not-working

I attached a gist of my code. Have tried many other iterations along the way. Anyone experience this? Is it a webpack thing?

Reproduction

https://gist.github.com/mattgatee/95e7ce825f2d62e636d5f82fe0d1b65a

chart.js version

v4.2.1

react-chartjs-2 version

v5.2.0

Possible solution

No response

I started using chartjs-adapter-moment as a solution

For some reason, using another adapter doesn't work. For example, I tried using chartjs-adapter-luxon but it didn't work.