Explorar o código

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

Igor Randjelovic %!s(int64=6) %!d(string=hai) anos
pai
achega
665455f8da
Modificáronse 1 ficheiros con 6 adicións e 3 borrados
  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) {
   if (!devtoolHook) return