Skip to content

Commit 4c81e9a

Browse files
mikeifominremy
authored andcommitted
fix: catch module.parent.filename === undefined (#1053)
It happened with electron.js. Maybe some wrapper module has a native nature
1 parent 1613394 commit 4c81e9a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/utils/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ var utils = module.exports = {
1616
isLinux: process.platform === 'linux',
1717
isRequired: (function () {
1818
var p = module.parent;
19-
while (p) {
19+
while (p) {
20+
// in electron.js engine it happens
21+
if (p.filename === undefined) {
22+
return true;
23+
}
2024
if (p.filename.indexOf('bin' + path.sep + 'nodemon.js') !== -1) {
2125
return false;
2226
}
@@ -87,4 +91,4 @@ Object.defineProperty(utils, 'colours', {
8791
get: function () {
8892
return this.log.useColours;
8993
},
90-
});
94+
});

0 commit comments

Comments
 (0)