diff --git a/lib/module.js b/lib/module.js index 4d4414a927..0a18a5286b 100755 --- a/lib/module.js +++ b/lib/module.js @@ -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) + } }) } }