-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Open
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Description
What is the problem this feature will solve?
When ERR_UNSUPPORTED_ESM_URL_SCHEME throws, we get a nice message about the wrongly used protocol.
But this does not provide enough context to pinpoint where this happens in a codebase.
What is the feature you are proposing to solve the problem?
I would like to suggest to add the URL.href or URL.pathname to the logging for ERR_UNSUPPORTED_ESM_URL_SCHEME errors.
This would mean editing this piece of code:
Lines 1835 to 1843 in c96e96c
E('ERR_UNSUPPORTED_ESM_URL_SCHEME', (url, supported) => { | |
let msg = `Only URLs with a scheme in: ${formatList(supported)} are supported by the default ESM loader`; | |
if (isWindows && url.protocol.length === 2) { | |
msg += | |
'. On Windows, absolute paths must be valid file:// URLs'; | |
} | |
msg += `. Received protocol '${url.protocol}'`; | |
return msg; | |
}, Error); |
Adding something like
msg += `. Received path '${url.pathname}`;
What alternatives have you considered?
Debugging this manually in a large codebase with external dependencies is hell.
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Type
Projects
Status
Awaiting Triage