I have a Vue JS project using Webpack and need to import Chart.js. I have tried
// import Chart from 'chart.js/Chart.min.js'
This gives js errors when trying to use the library.
I have a Vue JS project using Webpack and need to import Chart.js. I have tried
// import Chart from 'chart.js/Chart.min.js'
This gives js errors when trying to use the library.
After you do npm install chart.js
,
You can simply use
import Chart from 'chart.js'
to import chart.js Hope it helps.
As seen on this issue, if you use Angular CLI you only need to add this to the scripts array in angular-cli.json:
"../node_modules/chart.js/dist/Chart.bundle.min.js"
Restart your application, live reload won't do the trick.