Browse Source

ensure non 'MODULE_NOT_FOUND' exceptions are thrown by loadModule

master
Lloyd Brookes 8 years ago
parent
commit
86b2b52291
  1. 3
      lib/local-web-server.js
  2. 2
      package.json

3
lib/local-web-server.js

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

2
package.json

@ -39,7 +39,7 @@
"dependencies": { "dependencies": {
"ansi-escape-sequences": "^3.0.0", "ansi-escape-sequences": "^3.0.0",
"array-back": "^1.0.4", "array-back": "^1.0.4",
"command-line-args": "^3.0.5",
"command-line-args": "^4.0.1",
"command-line-usage": "^4.0.0", "command-line-usage": "^4.0.0",
"config-master": "^2.1.0-0", "config-master": "^2.1.0-0",
"koa": "next", "koa": "next",

Loading…
Cancel
Save