Add amcharts4 library js version

Hello. I find that cdn not contain amcharts 4 library, only 3 version. Can somebody add it ?https://www.amcharts.com/download/

Hi @kostaz

It seems that amcharts changed their repo name from amcharts/amcharts3 to amcharts/amcharts4 and this broke the autoupdate function in cdnjs.

You can fix this issue (and the other one you are having) with a PR to the cdnjs repo.
If you can’t or don’t know how let me know and I will see if I can fix it this weekend.

I am in no way linked to cdnjs or cloudflare, I will be doing this in my own free time so please understand if I can’t do it straight away.

I opened a PR: https://github.com/cdnjs/cdnjs/pull/13820

2 Likes

@kostaz amcharts4 has been updated: https://cdnjs.com/libraries/amcharts4
Just make sure that you use the new updated version amcharts4 and not the old version amcharts.

2 Likes

Hello. I tried to use this lib and find mistake. On cdnjs we have not compilate version from https://github.com/amcharts/amcharts4/tree/master/dist/es2015
but if we will use it we need folder .internal.
Can you change it on https://github.com/amcharts/amcharts4/tree/master/dist/script ?

1 Like

Hi @kostaz ,

It seems that the cdnjs bot ignores hidden folders, not sure if that is by design or not.
Also I noticed that it didn’t add the .ts files even though this was added in package.json -> npmFileMap.files.

@MattIPv4 can you give more info about this?

amcharts4 is updating via NPM, so it does not use the folders from the GitHub repo @kostaz.
We are pulling in all the files from @amcharts/amcharts4, excluding the examples.

Regarding .ts files, I think there might be a .gitignore somewhere that’s stopping them being added. They’re only typings files though, so this shouldn’t break browser usage at all.

@MattIPv4 I downloaded amcharts4 from NPM and it does include the .internal folder. So this is definitely an issue on cdnjs side.

amCharts 4 doesn’t work.

When I point to “cdnjs.cloudflare.com” instead of “www.amcharts.com” I get this error in the console:

core.min.js:1 Uncaught SyntaxError: Unexpected token ‘export’
charts.min.js:1 Uncaught SyntaxError: Unexpected token ‘export’

I’m not very hip with Javascript. I did some investigating and apparently “export” is TypeScript and not Javascript. So, it would appear that amCharts is not building correctly on the cdnjs end?

No this is correct Javascript but not intended to be used on the client side but as a module.
Cdnjs fetches the files from NPM and these are build to be used as ES2015/ES6 modules and not as a Javascript script in the frontend.

Hmm actually this makes this library unusable on cdnjs :thinking: I don’t think you can use it in your project.
@MattIPv4 what do you think about this? I didn’t know the code was module based.

ES Modules are supported in modern browers if you add type="module" to the script tag. Not much we can do if the library only provides ESM bundles in their package.

1 Like

2020-05-14_09-34-53
It is information from official github https://github.com/amcharts/amcharts4 .
Can you create amchart4-script on cdnjs ( https://github.com/amcharts/amcharts4/tree/master/dist/script ) ? They publish two versions: TypeScript, JavaScript.

P.s. I understand that usually cdnjs update library via NPM, but in NPM amcharts don’t publish JavaScript version.

cdnjs uses NPM and it contains TS and JS files.

Javascript: https://cdnjs.cloudflare.com/ajax/libs/amcharts4/4.9.21/core.js
Typescript: https://cdnjs.cloudflare.com/ajax/libs/amcharts4/4.9.21/core.d.ts
Both from NPM and available in cdnjs

If i understand it right, it isn’t usually JavaScript. It is JavaScript generated for TypeScript application. You can’t use it in old application without TypeScript and modules.

Apologies for the late reply here. Please create an issue on cdnjs/cdnjs proposing the idea of changing this library to using git auto-update, as well as information about why this change should happen and what files you think are needed (based on the conversation here).

Thank you!