@@ -81,8 +81,10 @@ export class Store {
8181
8282 const mutation = { type, payload }
8383 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+ }
8688 return
8789 }
8890 this . _withCommit ( ( ) => {
@@ -111,8 +113,10 @@ export class Store {
111113 } = unifyObjectStyle ( _type , _payload )
112114
113115 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+ }
116120 return
117121 }
118122 return entry . length > 1
@@ -399,8 +403,10 @@ function registerAction (store, type, handler, local) {
399403}
400404
401405function 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+ }
404410 return
405411 }
406412 store . _wrappedGetters [ type ] = function wrappedGetter ( store ) {
@@ -442,10 +448,12 @@ function unifyObjectStyle (type, payload, options) {
442448}
443449
444450export 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+ }
449457 return
450458 }
451459 Vue = _Vue
0 commit comments