-
Notifications
You must be signed in to change notification settings - Fork 97
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
The library does not work correctly when used via esm-cdn
#1797
Comments
I've looked at the build output of esm.sh... I did notice a few weird things. For some strange reason it uses I also noticed that it's exporting twice from /* esm.sh - @amcharts/[email protected]/themes/Animated */
export * from "/v135/@amcharts/[email protected]/es2022/themes/Animated.js";
export { default } from "/v135/@amcharts/[email protected]/es2022/themes/Animated.js"; It shouldn't need the second And it's importing /* esm.sh - @amcharts/[email protected] */
import "/v135/[email protected]/es2022/tslib.mjs";
import "/v135/[email protected]/es2022/svg-arc-to-cubic-bezier.mjs";
import "/v135/[email protected]/es2022/d3-shape.mjs";
export * from "/v135/@amcharts/[email protected]/es2022/amcharts5.mjs"; /* esm.sh - @amcharts/[email protected]/percent */
import "/v135/[email protected]/es2022/tslib.mjs";
import "/v135/[email protected]/es2022/d3-shape.mjs";
export * from "/v135/@amcharts/[email protected]/es2022/percent.js"; The above things are pretty minor, but I found a major bug with esm.sh. I noticed that it's not handling cross-file imports properly. The So it seems to be splitting each file into separate unrelated chunks, instead of sharing a single chunk. |
Thank you very much for the work done, I will double-check each error and open relevant issues in the ESM.SH repository. Please report if you find any more errors. I will report progress on the issues raised in this thread so that you can return to this issue at a later date. |
In the broken chart example, I accidentally used multiple versions of AMCharts. 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. 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 |
Here in the file five But it seems that ESM.SH returned not five modules of one project, but five differently builded projects. Accordingly, all variables exported from modules are their own for each This must be the problem I was looking for. Thank you very much. |
Yes, that's what I meant when I said that it's building multiple chunks instead of sharing a single chunk. |
The library does not work correctly when used via esm-cdn
Expected
See Donut Chart - Working example
Observed
See Donut Chart - Non-working example(deprecated)See Donut Chart - Non-working example
Additional info
I have raised a related issue in the esm.sh repository esm-dev/esm.sh#934
Could you share more details for
ESM.SH
developers? What exactly was assembled incorrectly? Is there a bug somewhere in the code or is some specific dependency not working correctly?I also see that this issue has already been raised previously in #1564, but I was unable to continue that discussion.
The text was updated successfully, but these errors were encountered: