Explorar o código

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
李洋 %!s(int64=6) %!d(string=hai) anos
pai
achega
91f3e69ed9
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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
   }