-
Hi there, I've run into a really strange problem using a combination of My code is as follows:
The rest of this Vue component is probably not relevant because the "LinearScaleBase is not defined" error happens on the import of ChartDataLabels (line 2), and things don't go any further. I don't think it's the order of imports or classes given to ChartJS.register(), because I tried using a dynamic import for ChartDataLabels and registering it with ChartJS on the completion of the promise, and similarly LinearScaleBase was not found. My only other thought is that it may be a tree-shaking problem because I've noticed the code works without problems on a local Any thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'm not sure if this is a good solution, but it's the only one I've been able to find so far. Instead of using the ESM module: I'm now using the non-ESM module: This seems to avoid the tree-shaking issues I was experiencing, possibly at the expense of not tree-shaking the library at all. |
Beta Was this translation helpful? Give feedback.
I'm not sure if this is a good solution, but it's the only one I've been able to find so far.
Instead of using the ESM module:
import ChartDataLabels from 'chartjs-plugin-datalabels'
I'm now using the non-ESM module:
import ChartDataLabels from 'chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.js'
This seems to avoid the tree-shaking issues I was experiencing, possibly at the expense of not tree-shaking the library at all.