@@ -81,8 +81,10 @@ export class Store {
81
81
82
82
const mutation = { type, payload }
83
83
const entry = this . _mutations [ type ]
84
- if ( process . env . NODE_ENV !== 'production' && ! entry ) {
85
- console . error ( `[vuex] unknown mutation type: ${ type } ` )
84
+ if ( ! entry ) {
85
+ if ( process . env . NODE_ENV !== 'production' ) {
86
+ console . error ( `[vuex] unknown mutation type: ${ type } ` )
87
+ }
86
88
return
87
89
}
88
90
this . _withCommit ( ( ) => {
@@ -111,8 +113,10 @@ export class Store {
111
113
} = unifyObjectStyle ( _type , _payload )
112
114
113
115
const entry = this . _actions [ type ]
114
- if ( process . env . NODE_ENV !== 'production' && ! entry ) {
115
- console . error ( `[vuex] unknown action type: ${ type } ` )
116
+ if ( ! entry ) {
117
+ if ( process . env . NODE_ENV !== 'production' ) {
118
+ console . error ( `[vuex] unknown action type: ${ type } ` )
119
+ }
116
120
return
117
121
}
118
122
return entry . length > 1
@@ -399,8 +403,10 @@ function registerAction (store, type, handler, local) {
399
403
}
400
404
401
405
function registerGetter ( store , type , rawGetter , local ) {
402
- if ( process . env . NODE_ENV !== 'production' && store . _wrappedGetters [ type ] ) {
403
- console . error ( `[vuex] duplicate getter key: ${ type } ` )
406
+ if ( store . _wrappedGetters [ type ] ) {
407
+ if ( process . env . NODE_ENV !== 'production' ) {
408
+ console . error ( `[vuex] duplicate getter key: ${ type } ` )
409
+ }
404
410
return
405
411
}
406
412
store . _wrappedGetters [ type ] = function wrappedGetter ( store ) {
@@ -442,10 +448,12 @@ function unifyObjectStyle (type, payload, options) {
442
448
}
443
449
444
450
export function install ( _Vue ) {
445
- if ( process . env . NODE_ENV !== 'production' && Vue ) {
446
- console . error (
447
- '[vuex] already installed. Vue.use(Vuex) should be called only once.'
448
- )
451
+ if ( Vue ) {
452
+ if ( process . env . NODE_ENV !== 'production' ) {
453
+ console . error (
454
+ '[vuex] already installed. Vue.use(Vuex) should be called only once.'
455
+ )
456
+ }
449
457
return
450
458
}
451
459
Vue = _Vue
0 commit comments