Explorar o código

disallow to register the root module by registerModule

ktsn %!s(int64=8) %!d(string=hai) anos
pai
achega
bb8ba9e457
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/store.js

+ 2 - 0
src/store.js

@@ -140,6 +140,8 @@ export class Store {
   registerModule (path, rawModule) {
     if (typeof path === 'string') path = [path]
     assert(Array.isArray(path), `module path must be a string or an Array.`)
+    assert(path.length > 0, 'cannot register the root module by using registerModule.')
+
     this._modules.register(path, rawModule)
     installModule(this, this.state, path, this._modules.get(path))
     // reset store to update getters...