-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
Description
When not using a file extension in ESM - eg import pkg from './path'
we currently just throw a straightforward not found error. As proposed by @MylesBorins in nodejs/modules#443 it would be useful to enhance this error message.
Ideally the error message should run the CJS resolver and say "the CJS resolver would have resolved this module to ...". We actually previously had this code path implemented by @bmeck but it seems to have got lost along the way. See the early implementation at https://github.com/nodejs/node/pull/14369/files#diff-3e94629c67625a2547d1507d0a547211R20.
Sorry @bmeck I think I might have dropped this and forgot to add it back when refactoring error codes to be standard. That was bad.
iwnowAmagon96 and juanarbol
Metadata
Metadata
Assignees
Labels
esmIssues and PRs related to the ECMAScript Modules implementation.Issues and PRs related to the ECMAScript Modules implementation.feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.