Skip to content

Commit

Permalink
Solve minor bug in node port related to the import of node modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Jan 29, 2021
1 parent 08826fc commit 5964dd6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions source/ports/node_port/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ mod.prototype.require = function (name) {
};

/* Try to load it with NodeJS first */
try {
return node_require.apply(this, [ name ]);
} catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') {
throw e;
}
}

try {
return node_require.apply(this, [ require.resolve(name) ]);
} catch (e) {
Expand Down

0 comments on commit 5964dd6

Please sign in to comment.