1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-21 21:50:00 -05:00

fix(require): use canonicalized path for loading content (#20133)

This commit is contained in:
Bartek Iwańczuk 2023-08-15 09:10:54 +02:00 committed by GitHub
parent ece2a3de5b
commit 119526a7a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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