diff --git a/lib/internal/process/execution.js b/lib/internal/process/execution.js
index c95567c506237f..5eda7541c8e4e1 100644
--- a/lib/internal/process/execution.js
+++ b/lib/internal/process/execution.js
@@ -55,6 +55,7 @@ function evalScript(name, body, breakFirstLine, printResult) {
   const { kVmBreakFirstLineSymbol } = require('internal/util');
 
   const cwd = tryGetCwd();
+  const origModule = global.module;  // Set e.g. when called from the REPL.
 
   const module = new CJSModule(name);
   module.filename = path.join(cwd, name);
@@ -79,6 +80,9 @@ function evalScript(name, body, breakFirstLine, printResult) {
     const { kStdout, print } = require('internal/util/print');
     print(kStdout, result);
   }
+
+  if (origModule !== undefined)
+    global.module = origModule;
 }
 
 const exceptionHandlerState = { captureFn: null };