-
Notifications
You must be signed in to change notification settings - Fork 50
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
Uncaught ReferenceError: AmCharts is not defined, in webpack2 import #51
Comments
What does your |
I had tried using both |
It actually is not with the version in your package.json. With 2.x, you can see that the index.js does not load the amcharts module like in the latest 1.x version. |
You need to add this to your html file. Otherwise, it will throw errors.
|
How did you solve the issue? I'm facing the same problem using gulp. I am using script tags and the import at the same time. |
is it possible to load the online imports into the project? |
Online imports must be in the package, for some clients we are not allowed to get content from the CDN. The react package must be standalone, installing all of its dependencies locally. |
A workaround could be to also
I still get a pre-render error complaining that AmCharts is not defined, but eventually it renders and can see the library being loaded correctly. This is not pretty, though, and I think some better examples of how to use amcharts with React and NPM specifically could be worked out. If you are distributing over NPM then using a CDN to load the base library is not a solution and defeats the whole purpose of having a dependency manager manage your dependencies. |
You can work around most but I couldn't figure out a clean way to import the |
can you plz fix that. I haven't found a way to include them without errors. |
@jeffsrepoaccount This is what I am currently doing in my project to import them and I am not getting an error.
|
@cemremengu That isn't possible, because the AmCharts export plugin dynamically loads files at runtime, which is why you must use If you do not want to use our CDN, you can download AmCharts, put the AmCharts files on your server, then use @jeffsrepoaccount @freakaziod210 That won't work if you use the export plugin. We agree that being able to use npm + webpack to manage everything is a good thing. But AmCharts v3 was made many many years ago, before npm or webpack even existed. Because of that, AmCharts v3 is designed to work with However, we are actively working on AmCharts v4. It is not finished yet, but when it is released it will have full support for npm + webpack. |
script |
We npm install amcharts/amcharts3 then use dynamic import, this way we achieve encapsulation and code split. |
I went ahead and added the 3 script calls, and the charts work in the app, but when i use Jest to test things, i still get this message. any help/ideas are appreciated... |
Same problem here @runn-vermel ... Did you manage to find a solution? |
Nope - I commented stuff out, and will likely upgrade to a different
library. Sorry I'm not more help :(
…On Mon, Jan 29, 2018 at 01:51 HarryFaulkner ***@***.***> wrote:
Same problem here @runn-vermel <https://github.com/runn-vermel> ...
Did you manage to find a solution?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#51 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEGM8fgLpwYNiAEBUx8De_5qKkd4EHh-ks5tPZSOgaJpZM4OHZwI>
.
|
at least you have load this files <script src="https://www.amcharts.com/lib/3/amcharts.js"></script> <script src="https://www.amcharts.com/lib/3/serial.js"></script> <script src="https://www.amcharts.com/lib/3/themes/light.js"></script>then you can use this library in react .... |
I would just like to point out that we have released V4, which has excellent built-in support for npm/Webpack/React: https://www.amcharts.com/javascript-charts/ We will still support V3 for a while, but our effort is primarily going into V4. |
I just failed to import AmCharts with guidelines from the tutorial.
Below are my files:
chart.js
package.json
webpack.config.js
The text was updated successfully, but these errors were encountered: