diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index 5ea3f55c52fffc..b8eed4b808a965 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -96,8 +96,9 @@ function updateChildren(parent, child, scan) {
     children.push(child);
 }
 
-function Module(id, parent) {
+function Module(id = '', parent) {
   this.id = id;
+  this.path = path.dirname(id);
   this.exports = {};
   this.parent = parent;
   updateChildren(parent, this, false);