Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 415fb56

Browse filesBrowse files
guybedfordgibfahn
authored andcommitted
module: fix extension lookups for top-level main
The reason is that absolute URLs do not go through extension and index checks. By switching to an absolute path, the resolver still applies extensions properly to the top-level main. PR-URL: #16526 Fixes: #16476 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent e683077 commit 415fb56
Copy full SHA for 415fb56

File tree

Expand file treeCollapse file tree

2 files changed

+8
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-1
lines changed
Open diff view settings
Collapse file

‎lib/module.js‎

Copy file name to clipboardExpand all lines: lib/module.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ Module._load = function(request, parent, isMain) {
452452
ESMLoader.hook(hooks);
453453
}
454454
}
455-
await ESMLoader.import(getURLFromFilePath(request).href);
455+
await ESMLoader.import(getURLFromFilePath(request).pathname);
456456
})()
457457
.catch((e) => {
458458
console.error(e);
Collapse file
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
require('../common');
3+
const { execFileSync } = require('child_process');
4+
5+
const node = process.argv[0];
6+
7+
execFileSync(node, ['--experimental-modules', 'test/es-module/test-esm-ok']);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.