Answer the question
In order to leave comments, you need to log in
How to defeat window is not defined in a plug-in?
Help? please correctly defeat the error.
nuxt.config.js
module.exports = {
plugins: {
'~plugins/fullpage-vue.js'
},
build: {
vendor: [
'fullpage-vue'
]
...
}
import Vue from 'vue'
import VueFullpage from 'fullpage-vue'
if (process.BROWSER_BUILD) {
Vue.use(VueFullpage)
}
Answer the question
In order to leave comments, you need to log in
In Nuxt, plugins are processed on both the server and the client, but since there is no window object on the server, you need to tell nuxt that this plugin should not be used with SSR
module.exports = {
plugins: [
// ssr: false to only include it on client-side
{ src: '~plugins/fullpage-vue.js', ssr: false }
],
build: {
vendor: [
'fullpage-vue'
]
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question