Skip to content

Add amcharts5 w/ git auto-update - #2204

Open
amcharts wants to merge 2 commits into
cdnjs:masterfrom
amcharts:add-amcharts5
Open

amcharts wants to merge 2 commits into
cdnjs:masterfrom
amcharts:add-amcharts5

Conversation

@amcharts

@amcharts amcharts commented Sep 25, 2026 •

Copy link
Copy Markdown

Adds amCharts 5, the current major version of amCharts. amCharts 3 (amcharts) and amCharts 4 (amcharts4) are already on cdnjs.

Popularity: @amcharts/amcharts5 has about 1.26M npm downloads per month.

Source: amcharts/amcharts5-dist is a public repo that our release process updates automatically, with one plain semver tag per release (starting at 5.20.8). It holds the pre-built browser (script tag) files in the same layout as our own CDN (cdn.amcharts.com/lib/5/). The npm package can't be used as the source, because it only contains ES module source for bundlers.

Files: each directory is listed explicitly (no globstars):

  • library, plugins, themes, locales and lazy-loaded dependencies (*.js, deps/, plugins/, themes/, locales/): 93 files, about 4.1 MB
  • low-detail maps only (*Low.js in geodata/ and its region directories), plus the small geodata/data/ and geodata/lang/ files

In total 764 files, about 48 MB per version. The largest single file is 1.8 MB. Source maps, fonts for the PDF export, JSON geodata and high-detail maps are left out; they stay available from our own CDN.

Optimization: js: false, because the files are already minified.

License: free under the amCharts linkware license (a small branding link on charts), or commercial. Same as amcharts and amcharts4.

Updated after review: the first version used globstars and included everything (about 383 MB per version).

@MattIPv4 MattIPv4 changed the title Add amcharts5 Add amcharts5 w/ git auto-update Sep 26, 2026

@MattIPv4 MattIPv4 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Files: all .js, .map and .json files, except package.json:

  • library, plugins, themes, locales and lazy-loaded dependencies: about 18 MB

  • geodata/: map files as JS (about 170 MB) and as JSON in geodata/json/ (about 170 MB). Our docs load the JSON versions on demand, e.g. for map drill-downs.

  • fonts/: fonts for the PDF export, about 27 MB

About 383 MB per version in total. We release about 25 times a year. Only one tagged version exists (5.20.8), so the initial import is a single version. That version doesn't have the JSON geodata yet (about 214 MB); later versions will.

We include geodata so that cdnjs URLs mirror our CDN's /geodata/ paths. Most of the geodata size comes from the High and Ultra detail maps. If the size is a concern, we're happy to leave those out (about 132 MB per version)

All of that feels incredibly large, and I imagine our CI will have issues with it 😓

18MB alone for just the library itself seems excessive, equally 27MB of bundled fonts seems like a lot when fonts are already available online (cdnjs itself, Google Fonts, etc.).

I can understand the geodata being so large, but I suspect that will also present a problem for the CI due to its size. It may be pertinent to do what you've suggested and drop the higher-detail versions if they're not required.

Comparing to amcharts4 on cdnjs, it does not appear to have this bloat at all.

Comment thread packages/a/amcharts5.json Outdated
Comment on lines +26 to +27
"**/*.@(js|map)",
"**/!(package).json"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not like to introduce globstars in new configs, as it can result in files being introduced that should not be on cdnjs. Please can we list the specific directories that files need to be pulled from?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 07fc0ec

@amcharts

Copy link
Copy Markdown
Author

Thanks for the review! Updated in 07fc0ec:

  • No globstars. The config now lists each directory explicitly (16 patterns, all single-level).
  • Library: 18 MB reduced to 4.1 MB. Most of the 18 MB was source maps (13.5 MB). They're dropped; the library itself is 93 files.
  • Fonts dropped. For context, these weren't web fonts but font files embedded in JS for pdfmake's virtual file system, used only when exporting PDFs with CJK, Arabic, Hebrew or Thai text. They aren't needed on cdnjs.
  • Geodata: only low-detail maps. High and Ultra detail maps and the JSON copies are dropped. Only *Low.js maps remain, plus the small data/ and lang/ files.

Total is now 764 files, about 48 MB per version (down from 383 MB). The largest single file is 1.8 MB (deps/pdfmake.js).

Compared to amcharts4: in v4, geodata was a separate package that never made it to cdnjs, so its entry has no maps at all. Maps are a big part of what amCharts is used for, so we'd like to include the low-detail set. If 48 MB is still too much, we could cut it down to the world, continent and country maps only (about 29 MB) and leave out the US/Canada/Mexico sub-region maps.

@amcharts
amcharts requested a review from MattIPv4 September 26, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants