Răsfoiți Sursa

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

Igor Randjelovic 6 ani în urmă
părinte
comite
665455f8da
1 a modificat fișierele cu 6 adăugiri și 3 ștergeri
  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