summaryrefslogtreecommitdiff
path: root/ext/node/02_require.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/02_require.js')
-rw-r--r--ext/node/02_require.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/node/02_require.js b/ext/node/02_require.js
index d71ea611a..f2b42da53 100644
--- a/ext/node/02_require.js
+++ b/ext/node/02_require.js
@@ -40,6 +40,9 @@
const cjsParseCache = new SafeWeakMap();
function pathDirname(filepath) {
+ if (filepath == null || filepath === "") {
+ throw new Error("Empty filepath.");
+ }
return ops.op_require_path_dirname(filepath);
}
@@ -470,6 +473,7 @@
if (isMain) {
node.globalThis.process.mainModule = module;
+ mainModule = module;
module.id = ".";
}
@@ -884,6 +888,7 @@
cjsParseCache,
readPackageScope,
bindExport,
+ moduleExports: m,
},
};
})(globalThis);