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 d1f4bef

Browse filesBrowse files
guybedfordtargos
authored andcommitted
module: pass full URL to loader for top-level load
PR-URL: #29736 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
1 parent 69f2634 commit d1f4bef
Copy full SHA for d1f4bef

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+3
-3
lines changed
Open diff view settings
Collapse file

‎lib/internal/modules/cjs/loader.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/loader.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ Module.runMain = function() {
10011001
// Load the main module--the command line argument.
10021002
if (experimentalModules) {
10031003
asyncESM.loaderPromise.then((loader) => {
1004-
return loader.import(pathToFileURL(process.argv[1]).pathname);
1004+
return loader.import(pathToFileURL(process.argv[1]).href);
10051005
})
10061006
.catch((e) => {
10071007
internalBinding('errors').triggerUncaughtException(
Collapse file

‎test/fixtures/es-module-loaders/example-loader.mjs‎

Copy file name to clipboardExpand all lines: test/fixtures/es-module-loaders/example-loader.mjs
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export function resolve(specifier, parentModuleURL = baseURL /*, defaultResolve
1515
format: 'builtin'
1616
};
1717
}
18-
if (/^\.{0,2}[/]/.test(specifier) !== true && !specifier.startsWith('file:')) {
18+
if (/^\.{1,2}[/]/.test(specifier) !== true && !specifier.startsWith('file:')) {
1919
// For node_modules support:
2020
// return defaultResolve(specifier, parentModuleURL);
2121
throw new Error(
22-
`imports must begin with '/', './', or '../'; '${specifier}' does not`);
22+
`imports must be URLs or begin with './', or '../'; '${specifier}' does not`);
2323
}
2424
const resolved = new url.URL(specifier, parentModuleURL);
2525
const ext = path.extname(resolved.pathname);

0 commit comments

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