Skip to content

Commit

Permalink
Fixes vuejs#2250
Browse files Browse the repository at this point in the history
- Add check that code is running in a browser before adding devtools
  • Loading branch information
urbnjamesmi1 committed Jul 15, 2024
1 parent b18718b commit e06ad55
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
unifyObjectStyle
} from './store-util'

const isBrowser = typeof document !== 'undefined'

export function createStore (options) {
return new Store(options)
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e06ad55

Please sign in to comment.