mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
[modules] Support promise
This commit is contained in:
parent
336ebd4959
commit
b701424aae
@ -99,12 +99,15 @@ class Module {
|
||||
}
|
||||
// Call module with `this` context and pass options
|
||||
return new Promise((resolve, reject) => {
|
||||
return module.call(this, options, err => {
|
||||
const result = module.call(this, options, err => {
|
||||
if (err) {
|
||||
return reject(err)
|
||||
}
|
||||
resolve(module)
|
||||
})
|
||||
if (result && result.then instanceof Function) {
|
||||
return result.then(resolve)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user