apertureless / vue-parallax

🌌 Vue.js component for parallax image scroll effects
MIT License
638 stars 88 forks source link

Error in beforeCreate hook because of reference to local file #20

Closed niklashof closed 7 years ago

niklashof commented 7 years ago

The current version throws an error:

[Vue warn]: Error in beforeCreate hook: "ReferenceError: document is not defined"

This happens because there is a local file referenced:

at /Users/jjuszczak/Projekte/Privat/vue-parallax/src/components/Parallax.vue

line 3037:

beforeCreate: [_t], __file: "/Users/jjuszczak/Projekte/Privat/vue-parallax/src/components/Parallax.vue"

Environment

apertureless commented 7 years ago

Are you using it in a ssr environment? Like nuxt ? You need to add it as a plugin and then disable ssr for it.

As document and window are not defined on server side.

https://nuxtjs.org/guide/plugins/#client-side-only

17