Skip to content

Commit 19ec188

Browse files
committed
check for existence of module before setting to it, when running in node; fixes #2586
1 parent 02dfc7a commit 19ec188

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/shell.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ if (ENVIRONMENT_IS_NODE) {
7373
Module['thisProgram'] = process['argv'][1];
7474
Module['arguments'] = process['argv'].slice(2);
7575

76-
module['exports'] = Module;
76+
if (typeof module !== 'undefined') {
77+
module['exports'] = Module;
78+
}
7779
}
7880
else if (ENVIRONMENT_IS_SHELL) {
7981
if (!Module['print']) Module['print'] = print;

0 commit comments

Comments
 (0)