chartjs/chartjs-adapter-date-fns

Update dependency chart.js@"^4.0.0"

ram-you opened this issue · 6 comments

Please update Chart.js dependency to chart.js@"^4.0.0".
Thank you.

The peerDependency is "chart.js": ">=2.8.0" so it should work fine with 4.0

When upgrading to chart.js@4.0.1, here are the warnings I receive.

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [redacted]@0.1.0
npm WARN Found: chart.js@4.0.1
npm WARN node_modules/chart.js
npm WARN   peer chart.js@">=2.8.0" from chartjs-adapter-date-fns@2.0.1
npm WARN   node_modules/chartjs-adapter-date-fns
npm WARN     chartjs-adapter-date-fns@"^2.0.0" from the root project
npm WARN   1 more (the root project)

Reproduction of my error in this repl. The chart data was just pulled from an example, but what triggers the error is when the Chart tries to use the adapter when specifying a scale as a time or timeseries.

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /home/runner/KnowingFlawlessIrc/node_modules/chart.js/package.json

Would you like me to post this as a separate issue?

adamhp commented

Any ideas on how to work around this until there is a fix? @stevecastaneda

Any ideas on how to work around this until there is a fix? @stevecastaneda

I ended up just removing the plugin, and created the labels as strings when polling for chart data (moving the logic on how I wanted the dates to the backend). I planned to add it back in once I saw a release.

adamhp commented

@stevecastaneda I think I was able to fix the package.json in #62, but not sure if there are wider impacts with that type of change.