mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 06:05:11 +00:00
refactor: simplify return value in addModule (#4766)
This commit is contained in:
parent
381e0af52f
commit
9c9d519576
@ -111,7 +111,7 @@ export default class ModuleContainer {
|
||||
return this.addModule(moduleOpts, true /* require once */)
|
||||
}
|
||||
|
||||
addModule(moduleOpts, requireOnce) {
|
||||
async addModule(moduleOpts, requireOnce) {
|
||||
let src
|
||||
let options
|
||||
let handler
|
||||
@ -157,17 +157,7 @@ export default class ModuleContainer {
|
||||
options = {}
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
// Call module with `this` context and pass options
|
||||
const result = handler.call(this, options)
|
||||
|
||||
// If module send back a promise
|
||||
if (result && result.then) {
|
||||
return resolve(result)
|
||||
}
|
||||
|
||||
// synchronous
|
||||
return resolve()
|
||||
})
|
||||
const result = await handler.call(this, options)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user