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 https://github.com/nodejs/modules/issues/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.
I have the same issue with ESM "type": "module": extensionless files are not resolved
I think I could help with this
I quite lost with this issue, which Module method should I use? I was trying with Module._resolveFilename, but I'm having troubles with parent, parent url is file://whatever and not an instance of Module
I need some help D:
PR #30699
Resolved in #31906 thanks for @dnlup.