diff --git a/src/store.js b/src/store.js index 3ae6898f9..d6a6c5181 100644 --- a/src/store.js +++ b/src/store.js @@ -12,6 +12,8 @@ import { unifyObjectStyle } from './store-util' +const isBrowser = typeof document !== 'undefined' + export function createStore (options) { return new Store(options) } @@ -73,9 +75,9 @@ export class Store { app.provide(injectKey || storeKey, this) app.config.globalProperties.$store = this - const useDevtools = this._devtools !== undefined + const useDevtools = (this._devtools !== undefined ? this._devtools - : __DEV__ || __VUE_PROD_DEVTOOLS__ + : __DEV__ || __VUE_PROD_DEVTOOLS__) && isBrowser if (useDevtools) { addDevtools(app, this)