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
}
}
<!--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/c355">#c355</a>)</em></sub></div>