Chartjs-Uncaught ReferenceError: Chart is not defined in Laravel mix

0👍

The answer it just there

How to install Chart.js in Laravel? ("Uncaught ReferenceError: Chart is not defined")

its very simply we need to declare the Chert in file in a new js file.

create resource/js/loadbefore.js

require('chart.js/dist/chart.js');

in our webpack.mix.js

.js('resources/js/loadbefore.js', 'public/js')

execute npm run dev

after that in our blade tamplete we call loadbefore.js in the head part, an we can use Chart whitout any promblem

Leave a comment