Chart.js
Chart.js copied to clipboard
Chart.js v4 onwards, Missing Class properties transform
Expected behavior
Running with React v17, react-chartjs-2 v5.2.0. It should start up the application as used in Chart.js v3
Current behavior
Unable to start application, error prompted Missing class properties transform in node_modules\chart.js\dist\chart.js, line 568 "static defaults = {};"
Reproducible sample
Optional extra steps/info to reproduce
Just npm i chart.js v4 onwards and run the application
Possible solution
No response
Context
No response
chart.js version
v4.1 , v4.4
Browser name and version
Chrome, v117
Link to your project
No response
This is valid javascript. It might be that you are transpiling it to a lower version which does not understand this. Adding @babel/plugin-proposal-class-properties
should resolve this: https://stackoverflow.com/questions/35517245/error-missing-class-properties-transform
@LeeLenaleee Hello, I'm glad to see your answer
but I'm confusing
as I know, by default, @babel/plugin-proposal-class-properties only support code in src
, it is not auto-transform code in node_modules
What do you mean when you suggest we use that package to fix this issue?
and another question, why chart.js do not transpile whole code? why it still keep some static
in the built code
I am having the same problem and @LeeLenaleee is not a solution.
I had the same problem when running on node v14.21.3, but not when on v18.14.1.