Reduce Chart.js Webpack Bundle Size for Nuxt.js

March 21, 2020
Remove Moment.js dependency

Moment.js is installed along Chart.js as dependency

If you don’t need Moment.js

Edit nuxt.config.js.

export default {
  build: {
    /*
    ** You can extend webpack config here
    */
    extend (config, ctx) {
      // config.resolve.alias['chart.js'] = 'chart.js/dist/Chart.js'
      config.externals = {
        moment: 'moment'
      }
    }
  },
}

References:

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.