ensure non 'MODULE_NOT_FOUND' exceptions are thrown by loadModule

This commit is contained in:
Lloyd Brookes
2017-02-08 18:37:53 +00:00
parent 698864299a
commit 86b2b52291
2 changed files with 4 additions and 1 deletions

View File

@ -230,6 +230,9 @@ function loadModule (modulePath) {
tried.push(path.resolve(modulePath))
module = require(path.resolve(modulePath))
} catch (err) {
if (!(err && err.code === 'MODULE_NOT_FOUND')) {
throw err
}
const walkBack = require('walk-back')
const foundPath = walkBack(process.cwd(), path.join('node_modules', 'local-web-server-' + modulePath))
tried.push('local-web-server-' + modulePath)