Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Chart.js v3 - import error: 'chart.js' does not contain a default export (imported as 'Chart') #28

Closed
kashifshamaz21 opened this issue Feb 8, 2021 · 3 comments · Fixed by #31

Comments

@kashifshamaz21
Copy link

@benmccann I'm trying to use Chart.js 3.x with current version of chartjs-adapter-luxon (v0.2.2), and it seems like Chartjs-v3 isn't yet supported.

I get an import error while compiling:

./node_modules/chartjs-adapter-luxon/dist/chartjs-adapter-luxon.esm.js
Attempted import error: 'chart.js' does not contain a default export (imported as 'Chart').

Module Versions:

"chart.js": "3.0.0-beta.9",
"chartjs-adapter-luxon": "^0.2.2",

Is it possible to add support for v3, if the fix is only in making the right import and doesn't need lot of changes? I would be happy to send a PR if you can let me know the scope of change needed here.

@benmccann
Copy link
Collaborator

I think maybe the last version worked and the current doesn't. Try "chartjs-adapter-luxon": "0.2.1"

@kashifshamaz21
Copy link
Author

@benmccann Thanks for the quick response. Yes, I tried with 0.2.1 and I didn't see the above compile time error with that version. Would you be able to fix the import error for the latest version as well?

@etimberg etimberg linked a pull request Mar 7, 2021 that will close this issue
@iar01
Copy link

iar01 commented May 21, 2021

Go to
./node_modules/react-chartjs-2/es/index.js and change
import Chart from 'chart.js';
to
import {Chart} from 'chart.js'; it would work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants