Skip to content

Commit cbf68b5

Browse files
committed
Fix resolve module dir URL
1 parent 431c3e7 commit cbf68b5

2 files changed

Lines changed: 7 additions & 10 deletions

File tree

lib/module.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,16 +448,13 @@ Module._load = function(request, parent, isMain) {
448448
}
449449
if (filename === null || /\.mjs$/.test(filename)) {
450450
try {
451-
ESM.loader.import(request).catch(
452-
(e) => {
453-
console.error(e);
454-
throw e;
455-
}
456-
);
451+
ESM.loader.import(request).catch((e) => {
452+
console.error(e);
453+
throw e;
454+
});
457455
return;
458456
} catch (e) {
459-
e.stack;
460-
// well, it isn't ESM
457+
// well, it isn't ESM
461458
}
462459
}
463460
if (err) {

src/loader/module_wrap.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ inline URL resolve_index(URL search) {
370370
return resolve_extensions(URL("index", &search), false);
371371
}
372372
URL resolve_main(URL search) {
373-
URL pkg = URL("package.json", &search);
373+
URL pkg("package.json", &search);
374374
auto check = check_file(pkg);
375375
if (!check.failed) {
376376
auto iso = Isolate::GetCurrent();
@@ -404,7 +404,7 @@ URL resolve_main(URL search) {
404404
return URL("");
405405
}
406406
URL resolve_module(std::string specifier, URL* base) {
407-
URL parent = *base;
407+
URL parent(".", base);
408408
URL dir("");
409409
do {
410410
dir = parent;

0 commit comments

Comments
 (0)