Browse Source

fix: add warnings when the different namespaced modules has the same names… (#1554)

* add warnings when the different namespaced modules has the same namespace

* Add warnings when duplicate namespace for different namespaced modules

* Add warnings when duplicate namespace, merge if
李洋 6 years ago
parent
commit
91f3e69ed9
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/store.js

+ 3 - 0
src/store.js

@@ -301,6 +301,9 @@ function installModule (store, rootState, path, module, hot) {
 
   // register in namespace map
   if (module.namespaced) {
+    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
   }