Home forums Using CanvasJS Uncaught SyntaxError: Unexpected token import

This topic contains 1 reply, has 2 voices, and was last updated by  Vishwas R 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17330

    netcon
    Member

    Hi,

    I’m getting a “Uncaught SyntaxError: Unexpected token import”-error when I import CanvasJS in my react project.

    I import it via import CanvasJS from 'canvasjs'

    The console says thats the part where the error occurs:

    import Charts from '../core/charts';

    #17342

    Vishwas R
    Keymaster

    @netcon,

    Adding type=”text/babel” to the src attribute of script tag should work fine. Please refer this stackoverflow thread for more info. If this doesn’t solve the issue, kindly share sample project so that we can look into the code and help you out.

    Also please take a look at this jsfiddle on rendering Column Chart using ReactJS.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.