Przeglądaj źródła

feat(devtool): allow usage in non-browser environments (#1404)

Igor Randjelovic 6 lat temu
rodzic
commit
665455f8da
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6 3
      src/plugins/devtool.js

+ 6 - 3
src/plugins/devtool.js

@@ -1,6 +1,9 @@
-const devtoolHook =
-  typeof window !== 'undefined' &&
-  window.__VUE_DEVTOOLS_GLOBAL_HOOK__
+const target = typeof window !== 'undefined'
+  ? window
+  : typeof global !== 'undefined'
+    ? global
+    : {}
+const devtoolHook = target.__VUE_DEVTOOLS_GLOBAL_HOOK__
 
 
 export default function devtoolPlugin (store) {
 export default function devtoolPlugin (store) {
   if (!devtoolHook) return
   if (!devtoolHook) return