Fix: Add missing registerables key to UMD exports#10584
Conversation
LeeLenaleee
left a comment
There was a problem hiding this comment.
The registerables are not used in the code so afaik it should not break on that.
Also it seems there are 2 extra indents that should not be there
|
I would highly recommend not using with UMD version with Next.js. You should use the Node version instead (ESM) |
Co-authored-by: Jacco van den Berg <jaccoberg2281@gmail.com>
|
@LeeLenaleee hi, sorry for the indentation, probably the formatting did that. About the usage of import { registerables } from "chart.js";and probably Next.js' webpack selects the base file |
|
@LeeLenaleee as you can see, Lines 20 to 25 in 1551537 |
|
Yeah, Chart.js 3.x has non-ideal behavior in its |
|
@benmccann I don't get why should one use a "hackish" way to do stuff. |
|
It is not forgotten, the UMD build does not export anything except for the chart itself, only the ESM build exports the registerables that's why its under that sub category since bundlers use the ESM build. The UMD build also has no use case for the registerables since it already registers everything. You can try to use this import instead: |
|
@LeeLenaleee I understand your point now, but how would one intuitively understand that, because it was a terrible debugging session to find out that |
|
Because we did not know that SSR in next.js handled it this way, because all other bundler imports always work fine. And as @benmccann pointed out this will likely be resolved in V4 (where we are working on now) so then it wont be an issue anymore. |
|
I believe this was fixed by #10525 |
|
Yes, it was. I don't think we should merge this |
|
@kurkle @benmccann hi, I've seen the changes you referred me to, and |
|
Yes, which is correct. The change that will help you is that the |
|
What do we want to do with this since this should be resolved by #10525 and the UMD build should not need the registerables so I think we can close this. Because this feels like a hacky fix for a better solution we already have Any objections to closing this? |
|
I'll just close this. We can always re-open if needed. |
During Next.js development, I and @zivnadel found that the
registerablesexport was missing from the UMD exports while trying to do Server-Side-Rendering.The problem didn't re-appear with using Client-Side-Rendering.
After a thorough investigation, we found that it was not exported from
src/index.umd.jsso we added it.