From 4c81e9aa52de6dc2c7fded3dc98838318137a41d Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 4 Sep 2017 21:27:34 +0300 Subject: [PATCH] fix: catch module.parent.filename === undefined (#1053) It happened with electron.js. Maybe some wrapper module has a native nature --- lib/utils/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/utils/index.js b/lib/utils/index.js index d223da28..b8a8dafa 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -16,7 +16,11 @@ var utils = module.exports = { isLinux: process.platform === 'linux', isRequired: (function () { var p = module.parent; - while (p) { + while (p) { + // in electron.js engine it happens + if (p.filename === undefined) { + return true; + } if (p.filename.indexOf('bin' + path.sep + 'nodemon.js') !== -1) { return false; } @@ -87,4 +91,4 @@ Object.defineProperty(utils, 'colours', { get: function () { return this.log.useColours; }, -}); \ No newline at end of file +});