diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js index 092e7490a3..eb845f2375 100644 --- a/ext/node/polyfills/01_require.js +++ b/ext/node/polyfills/01_require.js @@ -833,7 +833,9 @@ Module._resolveFilename = function ( isMain, parentPath, ); - if (filename) return filename; + if (filename) { + return ops.op_require_real_path(filename); + } const requireStack = []; for (let cursor = parent; cursor; cursor = moduleParentCache.get(cursor)) { ArrayPrototypePush(requireStack, cursor.filename || cursor.id); @@ -891,7 +893,7 @@ Module.prototype.load = function (filename) { ); } - Module._extensions[extension](this, filename); + Module._extensions[extension](this, this.filename); this.loaded = true; // TODO: do caching