Skip to content

Commit 83a253e

Browse files
committed
fixup! fixup! esm: improve error when calling import.meta.resolve from data: URL
1 parent 015b5b6 commit 83a253e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/internal/errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,7 @@ E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url, supported) => {
17151715
return msg;
17161716
}, Error);
17171717
E('ERR_UNSUPPORTED_RESOLVE_REQUEST',
1718-
'Failed to resolve module specifier "%s": Invalid relative url or base scheme is not hierarchical.',
1718+
'Failed to resolve module specifier "%s" from "%s": Invalid relative url or base scheme is not hierarchical.',
17191719
TypeError);
17201720
E('ERR_USE_AFTER_CLOSE', '%s was closed', Error);
17211721

lib/internal/modules/esm/resolve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
828828
try {
829829
resolved = new URL(specifier, base);
830830
} catch (cause) {
831-
const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier);
831+
const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
832832
setOwnProperty(error, 'cause', cause);
833833
throw error;
834834
}
@@ -839,7 +839,7 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
839839
resolved = new URL(specifier);
840840
} catch (cause) {
841841
if (isRemote && !BuiltinModule.canBeRequiredWithoutScheme(specifier)) {
842-
const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier);
842+
const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
843843
setOwnProperty(error, 'cause', cause);
844844
throw error;
845845
}

0 commit comments

Comments
 (0)