Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixes #2250
- Add check that code is running in a browser before adding devtools
  • Loading branch information
urbnjamesmi1 committed Jul 15, 2024
commit e06ad55eb2d20133b7c8cbedd764b30bcbd04ad0
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