Home › forums › Using CanvasJS › VueJS + webpack
This topic contains 3 replies, has 2 voices, and was last updated by Priyanka M S 3 weeks, 6 days ago.
Hey everyone, I noticed that CanvasJS now supports ES6 module import/export.
So I eagerly went to do a proof of concept and prove it can work with our setup which is VueJS + webpack. However, I am receiving the following error when I try to use it: ‘TypeError: _canvasjs_min__WEBPACK_IMPORTED_MODULE_0__.Chart is not a constructor’. When I console log the CanvasJS object it seems pretty empty.
Any help resolving this issue would be greatly appreciated.
P.S. There was one other bug I noticed that is an easy fix. Our ESLint rules don’t allow trailing spaces, and in the V2.2 min file I downloaded there was a trailing space in the comment above the /* eslint-disable */ comment which means before it disabled the linter, it found something to complain about.
We are looking into it and will get back to you at the earliest.
Priyanka M S
We have figured out a way to get it working on our own. Our index.html file is a built file that starts out using a template file (index.template.html). If we simply include the minified trial version in a <script> tag there we can access it via window.CanvasJS successfully.
I am fairly confident that we tried this approach last time (months ago) and it did not work. I assume one of the recent versions have fixed whatever problem we were having before.
That all being said, I wanted to ask you if this approach could cause any problems for us in the future? Such as maybe that won’t work if we are using the paid version or something? Will this approach remain valid in future releases?
Such as maybe that won’t work if we are using the paid version or something? Will this approach remain valid in future releases?
There will be no issues regarding your approach with future releases of CanvasJS.
You must be logged in to reply to this topic.