Browse Source

disallow to register the root module by registerModule

ktsn 8 years ago
parent
commit
bb8ba9e457
1 changed files with 2 additions and 0 deletions
  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...