You must be logged in to post your query.
Home › Forums › Chart Support › Vuejs integration
Tagged: vue
Hi I have a problem when I added Canvasjs to my project.
I used Canvasjs v2.3.1.
I used https://jsfiddle.net/canvasjs/q1s6kc6x/ code. But I got ” “export ‘Chart’ (imported as ‘CanvasJS’) was not found in ” error.
How can I fix it ?
@silemanbed,
Importing canvasjs.min.js file to the project as import * as CanvasJS from '/path-to-canvasjs-file/canvasjs.min' should work fine. Please take a look at this Sample Project.
import * as CanvasJS from '/path-to-canvasjs-file/canvasjs.min'
If you are still facing the issue, please share sample project reproducing the issue you are facing over Google-Drive / Onedrive, so that we can run it locally at our end, understand the scenario better and help you out.
— Vishwas R Team CanvasJS
I am using webpack, when I run npm run serve, it is give the error. Also I try to use in a component.
Browser give below error:
[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.
(found in <Root>) warn @ webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:620 webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:620 [Vue warn]: Error in mounted hook: “TypeError: _canvasjs_min__WEBPACK_IMPORTED_MODULE_13__.Chart is not a constructor”
(found in <Root>) warn @ webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:620 webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:1887 TypeError: _canvasjs_min__WEBPACK_IMPORTED_MODULE_13__.Chart is not a constructor at Vue.mounted (webpack-internal:///./src/main.js:86) at invokeWithErrorHandling (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:1853) at callHook (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:4207) at mountComponent (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:4074) at Vue.$mount (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:8399) at Vue._init (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:5002) at new Vue (webpack-internal:///./node_modules/vue/dist/vue.runtime.esm.js:5069) at eval (webpack-internal:///./src/main.js:44) at Module../src/main.js (app.js:6579) at __webpack_require__ (app.js:724)
Also I download your project and run npm install and npm run start it gives same error: ./src/index.js Attempted import error: ‘Chart’ is not exported from ‘./canvasjs.min’ (imported as ‘CanvasJS’).
Please take a look at this Sample Project.
Thank you very much. It looks work
You must be logged in to reply to this topic. Login/Register