-
My build process (using vite with Laravel) for 3.x copies chart.js out of
Then when I want to draw a graph, I do: <script>
const myChart = new Chart(document.getElementById('myChart').getContext('2d'), {
... This is all working fine: libraries load, graphs are drawn. I updated from chart.js 3 to 4, simply by changing the version number in my package.json, reinstalling, and rebuilding my assets, and it breaks. The first issue is that I get:
From this I gather that the format of chart.js changed (though not mentioned in the migration docs?), so I need to add
I tried adding this to the top of my script:
but then I just get the first error again; this is clearly a clash of library types or something, but I wasn't expecting any of this to break. What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found the answer: The filename has changed. I now need to load |
Beta Was this translation helpful? Give feedback.
I found the answer: The filename has changed. I now need to load
chart.umd.js
instead of plainchart.js
. This would be useful to add to the migration guide.