Better errors on module not found

This repository was archived by the owner on Sep 2, 2023. It is now read-only.

This repository was archived by the owner on Sep 2, 2023. It is now read-only.

@MylesBorins

Description

I think it is going to be a fairly common pattern (for a while) that people will expect they can import a file without an extension. When a module is not found ERR_MODULE_NOT_FOUND is thrown. The error is thrown in module_wrap.cc within Maybe FinalizeResolution

Before throwing ERR_MODULE_NOT_FOUND we could check with the node resolution algorithm if there is a file that would have resolved with that specifier and let the developer know the path of the expected file.

Thoughts?