Import of chart.js 3 is not working #1856
Replies: 6 comments 7 replies
-
I think this is the same reason and will be fixed early next week. #1816 (reply in thread) |
Beta Was this translation helpful? Give feedback.
-
Hmm, this may be different than that issue. I can see the "Chart" export inside of the new Chartjs ESM entrypoint: https://unpkg.com/browse/[email protected]/dist/chart.esm.js If you feel comfortable adding logging info into your installed node_modules, it would be great to see what's going on inside of our UMD-> ESM handler. The file to add logs to is: const cjsExports = isExplicitAutoDetect
? cjsAutoDetectExportsTrusted(val)
: cjsAutoDetectExportsUntrusted(val);
+ console.log(normalizedFileLoc, isExplicitAutoDetect, cjsExports); That should tell us a bit about what's going on here. Feel free to add other log messages if see anything interesting! |
Beta Was this translation helpful? Give feedback.
-
I added logging info as you said, but nothing showed up in the console |
Beta Was this translation helpful? Give feedback.
-
Oh interesting, so that means that we're not doing any tree-shaking that could cause this. This is just what esinstall/Rollup sees when it scans that package for exports. If you run Snowpack with the Also: you can use the |
Beta Was this translation helpful? Give feedback.
-
It is not working. I am using Svelte, and the simplest possible app gives the following error: |
Beta Was this translation helpful? Give feedback.
-
I have a problem with Chart.js too, with the following error on the console:
Please let me know if I can do something to help. |
Beta Was this translation helpful? Give feedback.
-
I use chart.js 3 and have a problem with import.
I get error
Uncaught (in promise) SyntaxError: The requested module '../../../../web_modules/chartjs.js' does not provide an export named 'Chart'
My import looks like this
import { Chart, CategoryScale, LinearScale, LineController, LineElement, PointElement, BarController, BarElement, Tooltip } from 'chart.js';
Beta Was this translation helpful? Give feedback.
All reactions