Reputation: 2261
I am trying to reduce the size of my SPA build, which gets build using vue-cli build
. I am using Chart.js and after building the application, I ran webpack-bundle-analyzer
and it shows Chart.js with it's full size, and not chart.min.js
.
What I am expecting is that it would use /dist/chart.min.js
. I am not understanding this correctly, or is it actually using the non-minified file?
Upvotes: 2
Views: 391
Reputation: 2261
I got around to having another look at this and this is simply because vue-chartjs
needs chart.js
as peer dependency and is thus not taking care of anything in my side of the build step.
Related: https://github.com/apertureless/vue-chartjs/issues/249
The fix is to configure it accordingly in the webpack config:
resolve: {
alias: {
'chart.js$': 'chart.js/dist/Chart.min.js',
},
},
Upvotes: 1