Home forums Chart Support CanvasJS with Electron/Node.js

Tagged: ,

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #21240


    I’m trying to use CanvasJS with Electron, but I’m getting the bellow error:

    A JavaScript error occurred in the main process
    Uncaught Exception:
    import CanvasJS from ‘canvasjs’;

    SyntaxError: Unexpected token import

    In my code, I’m requiring CanvasJS as below:

    var CanvasJS = require(‘canvasjs’);

    Is there a workaround to solve this issue?

    Best regards



    Since Electron doesn’t support ES6 syntaxes, I used babel to convert from ES6 to CommonJS.

    Anyway, there is a error on npm module in the following file:


    The “export” syntaxes must be changed to “import”.

    Best regards



    Glad that you figured out.
    Using var CanvasJS = require('./canvasjs.min') should work fine. Here is a working sample.

    Priyanka M S
    Team CanvasJS

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.