amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
337 stars 91 forks source link

ESM.sh amcharts5 lib version is broken #1564

Closed fruitbang closed 1 month ago

fruitbang commented 2 months ago

Hello, I encountered the following problem. The library does not work as expected if you use the version from cdn: "https://esm.sh/@amcharts/amcharts5@5.9.11"

example: https://codepen.io/fruitbang/pen/YzbxoYL

So, cuz, i haven't opportunity to use the bundler on my project, I have to use cdn, but in the documentation of amharts, I found a link to cdn, where the umd iife module is stored. I would like to use the modern format: esm modules, but I encountered such a problem.

The issue of library delivery is also raised in this discussion: "https://github.com/amcharts/amcharts5/issues/82"

Pauan commented 2 months ago

I believe this is a bug with esm.sh, perhaps they don't properly handle libraries that have multiple entry points.

The reason we don't provide a CDN for ES6 modules is because amCharts uses npm modules, so it has to use a bundler in order to work in the browser.

esm.sh has its own bundling code, which doesn't seem to be working properly with amCharts. I suggest filing a bug with them.

fruitbang commented 2 months ago

Perhaps it is possible to compile not only the umd version of the library, but also the es6 version and distribute it from your CDN, so that it would be possible to use the modern syntax for importing a module into .js/.ts files, and not strange constructions with the Githubissues.

  • Githubissues is a development platform for aggregating issues.