Home › forums › Using CanvasJS › CanvasJS npm package for React
This topic contains 5 replies, has 2 voices, and was last updated by Indranil Deo 8 months, 2 weeks ago.
Wondering whether there are any CanvasJS npm package can be used for React+Webpack.
Here we tried to install canvasjs from https://www.npmjs.com/package/canvasjs, but build failed with below info:
ERROR in ./node_modules/canvasjs/src/charts/index.js
Module parse failed: Unexpected token (1:7)
You may need an appropriate loader to handle this file type.
| export SplineChart from ‘../charts/spline’;
| export ColumnChart from ‘../charts/column’;
| export StackedColumnChart from ‘../charts/stacked_column’;
@ ./node_modules/canvasjs/src/core/charts.js 40:0-61:25
@ dll vendor
The package mentioned above is not official but from a third party. We don’t have npm package as of now.
Is there any solution for using CanvasJS in React+Webpack?
Please download this sample project of integrating React+Webpack.
Also, please take a look at this jsfiddle to integrate CanvasJS with React.
Thanks for your sample, it was helpful for me.
And could you also help provide solution for using CanvasJS in React+Webpack+Typescript, actually the check of Typescript could not support “new CanvasJS.Chart” without define “CanvasJS” first.
We have just released v2.1 with module import/export with which you can easily integrate front-end framework like React, Angular, Vuejs, etc. Please refer to the release blog for more information. Do download the latest version from our download page and let us know your feedback.
You must be logged in to reply to this topic.