Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect building - @amcharts/amcharts5 #934

Open
Qsppl opened this issue Nov 26, 2024 · 3 comments
Open

Incorrect building - @amcharts/amcharts5 #934

Qsppl opened this issue Nov 26, 2024 · 3 comments
Labels
browser Not working in Browser

Comments

@Qsppl
Copy link

Qsppl commented Nov 26, 2024

Failing module

Expected

See Donut Chart - Working example

image

Observed

See Donut Chart - Non-working example (deprecated)
See Donut Chart - Non-working example

image

Additional info

This question has already been raised in the AmCharts repository itself. The AmCharts developers suspect that esm.sh uses its own npm package builder into esm modules and that the AmCharts package was not built correctly.

@Qsppl
Copy link
Author

Qsppl commented Dec 6, 2024

In the broken chart example, I accidentally used multiple versions of AMCharts.

image

In the past, this might have prevented you from finding the real problem.

I have fixed this problem and updated the example link in the first post of the thread.

image

Just in case, I’ll write down here a link to the previous example with importing several versions of AMCharts, so that you can compare the examples if necessary: https://codepen.io/qsppl/pen/KwPPLaa

@Qsppl
Copy link
Author

Qsppl commented Dec 6, 2024

I've raised a new issue on this topic in the AMCharts repository and there's progress there!

amcharts/amcharts5#1797

A little later I will post the issues found there to this repository

@Qsppl
Copy link
Author

Qsppl commented Dec 6, 2024

One of the AMCharts repository contributors (@Pauan) seems to have found the problem:

I noticed that it's not handling cross-file imports properly. The percent.js and Animated.js files are supposed to be importing things from amcharts5.mjs... but they aren't. There's no imports at all.

So it seems to be splitting each file into separate unrelated chunks, instead of sharing a single chunk.

If we go back to the example, everything looks exactly as he said:

Here in the file five imports of different modules of one project are performed:

image

But it seems that ESM.SH returned not five modules of one project, but five differently builded projects.

image

Accordingly, all variables exported from modules are their own for each import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser Not working in Browser
Projects
None yet
Development

No branches or pull requests

1 participant