From 19122df0693c9ad015853bd813156c778eb684e2 Mon Sep 17 00:00:00 2001 From: liyang <1909457483@qq.com> Date: Sun, 19 May 2019 19:46:03 +0800 Subject: [PATCH 1/3] add warnings when the different namespaced modules has the same namespace --- src/store.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/store.js b/src/store.js index a79252b50..2c2315c76 100644 --- a/src/store.js +++ b/src/store.js @@ -301,6 +301,13 @@ function installModule (store, rootState, path, module, hot) { // register in namespace map if (module.namespaced) { + const existedModule = store._modulesNamespaceMap[namespace] + if (existedModule) { + if (process.env.NODE_ENV !== 'production') { + console.error(`[vuex] duplicate namespace ${namespace} for the namespaced module ${path.join('/')}`) + } + return + } store._modulesNamespaceMap[namespace] = module } From 6019332da33126c87c6ff3a0ce7becc0dfc02bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=B4=8B?= <1909457483@qq.com> Date: Tue, 21 May 2019 22:49:25 +0800 Subject: [PATCH 2/3] Add warnings when duplicate namespace for different namespaced modules --- src/store.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/store.js b/src/store.js index 2c2315c76..a3b70e5ae 100644 --- a/src/store.js +++ b/src/store.js @@ -306,7 +306,6 @@ function installModule (store, rootState, path, module, hot) { if (process.env.NODE_ENV !== 'production') { console.error(`[vuex] duplicate namespace ${namespace} for the namespaced module ${path.join('/')}`) } - return } store._modulesNamespaceMap[namespace] = module } From 06ca019e6c27728e8a61b5ccd52faba768ad1c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=B4=8B?= <1909457483@qq.com> Date: Wed, 22 May 2019 09:59:08 +0800 Subject: [PATCH 3/3] Add warnings when duplicate namespace, merge if --- src/store.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/store.js b/src/store.js index a3b70e5ae..b32d7b0ad 100644 --- a/src/store.js +++ b/src/store.js @@ -301,11 +301,8 @@ function installModule (store, rootState, path, module, hot) { // register in namespace map if (module.namespaced) { - const existedModule = store._modulesNamespaceMap[namespace] - if (existedModule) { - if (process.env.NODE_ENV !== 'production') { - console.error(`[vuex] duplicate namespace ${namespace} for the namespaced module ${path.join('/')}`) - } + if (store._modulesNamespaceMap[namespace] && process.env.NODE_ENV !== 'production') { + console.error(`[vuex] duplicate namespace ${namespace} for the namespaced module ${path.join('/')}`) } store._modulesNamespaceMap[namespace] = module }