Home

Issue: 414

window is not defined

[issue link]

I feel there must be more to this error than what is described in the docs. I have spent a long time trying to get various scripts to work in Nuxt, and each time have failed to get passed the window is not defined error, despite adding:

if (process.BROWSER_BUILD) {
  require('external_library')
}

I won’t list all the scripts I tried here, but I’ll give one example: Vue.Isotope

nuxt.config.js

build: {
  vendor: [ 'vueisotope'],
}

.vue file

if (process.BROWSER_BUILD) {
  require('vueisotope')
}
import isotope from 'vueisotope'
export default {
  components: {
    isotope
  }
}
This question is available on Nuxt.js community (#c355)