new Chart(...) ReferenceError #9542
-
Hope I can get help here... I'm trying to include chart.js from a local server as plain JavaScript but when chart.js is included, the browser console reports the following error:
which looks to be line #11 of the chart.js file. Since this error occurs when loading the script, I get a ReferenceError when I reach my var chart = new Chart(...) code. I am not using React, RequireJS or any other "loaders". This is via a vanilla <script> tag. Any suggestions on how to resolve this? This is using the latest Chart.js v3.5.0 downloaded from jsDelivr |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Seems to be working just fine: https://jsfiddle.net/Leelenaleee/2ekt7av0/ |
Beta Was this translation helpful? Give feedback.
-
I discovered the issue was because I am doing this inside a Liferay portal and Liferay's Javascript loader (AMD?) was causing issues. I found a post on Stack Overflow which helped with a workaround. Sorry for the wild goose chase... |
Beta Was this translation helpful? Give feedback.
I discovered the issue was because I am doing this inside a Liferay portal and Liferay's Javascript loader (AMD?) was causing issues. I found a post on Stack Overflow which helped with a workaround. Sorry for the wild goose chase...