Issue with react-chartjs-2 #3783
Unanswered
sloonz
asked this question in
Troubleshooting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I’m having trouble to get react-chartjs-2 and plugins working with snowpack (3.8.8). After a bit of investigation, it turns out that chart.js is imported twice, once in its esm build, once in its commonjs build.
https://github.com/reactchartjs/react-chartjs-2/blob/master/src/index.tsx does :
It turns out that snowpack uses
node_modules/chart.js/auto/auto.js
forchart.js/auto
(which in turns uses the cjs build,node_modules/chart.js/dist/chart.js
), whereas it uses the esm build (node_modules/chart.js/dist/chart.esm.js
) forchart.js
.I’m stuck here : I’m pretty sure snowpack should use the esm version of
chart.js/auto
(it exists :node_modules/chart.js/auto/auto.esm.js
), but I have no idea why it doesn’t. Would appreciate any guidance on how to debug this further.(note: esbuild --bundle does the correct thing and only imports the esm version in both cases)
Beta Was this translation helpful? Give feedback.
All reactions