Static GitHub Issues

[1598] vue-chartjs dependency fails to load

prev: Browser compatibility on Android 6.0 build-in browser
next: @import default style from package results in TypeError

We have:

// nuxt.config.js

{
  src: '~plugins/vue-chartjs.js',
  ssr: false
},
// plugins/vue-chartjs.js

import Vue from 'vue'
import { Doughnut, Bar, mixins } from 'vue-chartjs'

Vue.component('portolio-chart', Doughnut.extend({
  props: ['data', 'options'],
  mounted () {
    this.renderChart(this.data, this.options)
  }
}))

This works fine on my colleague's Ubuntu machine, but when I try to run it on my Macbook Pro, or even in a Ubuntu VM, the dependency fails to load:

This dependency was not found:

* vue-chartjs in ./plugins/vue-chartjs.js

To install it, you can run: npm install --save vue-chartjs

Of course, the dependency is already installed, just as in https://github.com/nuxt/nuxt.js/issues/917 and https://github.com/nuxt/nuxt.js/issues/673.

I notice if I try to load the vue-chartjs library in a node.js console, I get:

ReferenceError: window is not defined

Which makes sense - it was designed for a browser environment. But I would expect the {ssr: false} to prevent the library from attempting to load on the server. Is {ssr: false} supported on our version of nuxt.js? We're using nuxt@0.10.7, vue@2.2.6.

Current approach seems consistent with proposed wrapper for vue-chartjs: https://github.com/apertureless/vue-chartjs/issues/168

What else could I be missing?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1433">#c1433</a>)</em></sub></div>