Skip to content

Commit bb8ba9e

Browse files
ktsnyyx990803
authored andcommitted
disallow to register the root module by registerModule
1 parent a7a775b commit bb8ba9e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/store.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ export class Store {
140140
registerModule (path, rawModule) {
141141
if (typeof path === 'string') path = [path]
142142
assert(Array.isArray(path), `module path must be a string or an Array.`)
143+
assert(path.length > 0, 'cannot register the root module by using registerModule.')
144+
143145
this._modules.register(path, rawModule)
144146
installModule(this, this.state, path, this._modules.get(path))
145147
// reset store to update getters...

0 commit comments

Comments
 (0)