summaryrefslogtreecommitdiff
path: root/ext/node/polyfills
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-08-15 09:10:54 +0200
committerGitHub <noreply@github.com>2023-08-15 09:10:54 +0200
commit119526a7a5fef24783e5a7a5f4fb05038b410c88 (patch)
tree6cb5007d56def8b8ea177b932afebdc260a0e0d8 /ext/node/polyfills
parentece2a3de5b19588160634452638aa656218853c5 (diff)
fix(require): use canonicalized path for loading content (#20133)
Diffstat (limited to 'ext/node/polyfills')
-rw-r--r--ext/node/polyfills/01_require.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js
index 092e7490a..eb845f237 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