Home Forums Chart Support vuejs. ‘Chart’ is not exported by ‘src/assets/canvasjs.min.js’

vuejs. ‘Chart’ is not exported by ‘src/assets/canvasjs.min.js’

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

    I am trying to test the vuejs-canvasjs-chart-samples in the lastest Vue version. If I try npm run dev, the example works right locally in my PC. But if I try npm run build it throws the following error: ‘Error when using sourcemap for reporting an error: Can’t resolve original location of error.
    ‘Chart’ is not exported by ‘src/assets/canvasjs.min.js’

    If I upload the dist folder in the server, the site doesn’t works, console throws: Error: Cannot read properties of undefined (reading 'Chart')`

    Any suggestion?

    #42589

    @rr4v,

    Thanks for bringing this issue to our notice. We will look into this & fix it soon.


    Vishwas R
    Team CanvasJS

    #43027

    @rr4v,

    We have added CanvasJS Vue Charts package to NPM registry. Kindly check out the NPM package & let us know if that fixes the issue you are facing.

    However, if you still like to use Vue component, kindly create separate chunks for CanvasJS during build and it should work fine in this case. Please find the vite-configuration below.

    export default defineConfig({
      plugins: [vue()],
      build: {
        rollupOptions: {
          output: {
            manualChunks: {
              canvasjs: ['./src/assets/CanvasJSVueComponent.vue', './src/assets/canvasjs.min.js'],
            },
          }
        }
      }
    })

    Kindly download the latest version of CanvasJS from our download page & let us know your feedback.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.