jsnanigans / vue-parallax-js

Tiny vue component that adds a directive for parallax effect on elements.
120 stars 19 forks source link

Conflict with Nuxt.js and Vuex #26

Closed Neo-Zhixing closed 4 years ago

Neo-Zhixing commented 5 years ago

When running in a Nuxt.js environment, the following error occurs:

Cannot read property '__VUE_DEVTOOLS_GLOBAL_HOOK__' of null

In Vuex, this code snippet directly caused the problem:

var devtoolHook =
  typeof window !== 'undefined' &&
  window.__VUE_DEVTOOLS_GLOBAL_HOOK__;

The problem was traced back to this package, which contains the following:

if (typeof window === 'undefined') {
  global.window = null
}

if (typeof document === 'undefined') {
  global.document = null
}

What was the reason for mutating global variables "window" and "document" from undefined to null? Does it cause any problems to remove these?

Neo-Zhixing commented 4 years ago

Closed by #27