Home forums Using CanvasJS Can canvasjs work with webpack

This topic contains 6 replies, has 4 voices, and was last updated by  Vishwas R 2 weeks ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #14821

    yueming
    Member

    I am trying to use canvasjs in a webpack-based project.

    I import canvasjs via code below

    import '../third/canvasjs/canvasjs.min';

    But there is an error of “Uncaught ReferenceError: chart is not defined” when code below is executed:
    b && (chart = this.chart || this, chart.render())

    It occurs when I execute code below:
    chart2.title.set('fontSize', chart1.title.get('fontSize'), true)

    It seems canvasjs.min.js is not in “use strict” mode, but it is now running in a “use strict” context.

    #14860

    Suyash Singh
    Moderator

    @yueming,

    We are working on it and will get back to you at the earliest.

    ___
    Suyash Singh
    Team CanvasJS

    #15612

    Austin
    Member

    Suyash, any update on this? I’m also running into issues with webpack.

    #15618

    Vishwas R
    Keymaster

    @austin,

    We have fixed the issue and here is an internal build for the same. Kindly download the fixed version and let us know your feedback.


    Vishwas R
    Team CanvasJS

    #15758

    Austin
    Member

    @vishwas

    Thanks! Sorry for the late reply.. I did not set up notifications for emails on the post.

    I tried the internal build and ran into the same issue: CanvasJS is not defined.

    Do you have an example of a webpack config that is working for you all?

    #15768

    Austin
    Member

    @vishwas

    I was able to get this working with WebPack now!

    Thank you so much–I will be on the lookout for the official push of this build in the future.

    Thanks,
    Austin

    #15774

    Vishwas R
    Keymaster

    Austin,

    Glad it’s working. Thanks for letting us know.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.