profile
viewpoint

Ask questionsUse consistent error codes for MODULE_NOT_FOUND

Right now ESM uses code: 'ERR_MODULE_NOT_FOUND' while CJS throws a similar error with code: 'MODULE_NOT_FOUND'. So far that looks to be accidental and worth fixing so code that catches these kinds of mistakes doesn't have to worry about which loader happened to throw it.

nodejs/modules

Answer questions guybedford

ERR_MODULE_NOT_FOUND was actually an intentional upgrade path in the ESM resolver since all Node.js error codes start with ERR_ these days.

If we want to change it to MODULE_NOT_FOUND though I'm fine with that too.

useful!

Related questions

Transition Path Problems For Tooling hot 1
Proposal: Support loading package by own "name" hot 1
JSON modules are being reverted on web hot 1
Out-of-Band Meeting Proposal hot 1
node v13.0-v13.1 errors on require of a module with "exports" defined hot 1
Out-of-Band Meeting Proposal hot 1
Loader Hooks hot 1
Proposal: Support loading package by own "name" hot 1
Github User Rank List