Commit 8f87d252 authored by Daniele Belardi's avatar Daniele Belardi Committed by Guy Bedford
Browse files

esm: improve commonjs hint on module not found

Run CommonJS resolver only if `error.code` is ERR_MODULE_NOT_FOUND.
Avoid using absolute paths in hint by:
* using a parent-relative path if the specifier is a relative path
* using a `pkg/x.js` format if the specifier is bare (e.g. `pkg/x`)

PR-URL: https://github.com/nodejs/node/pull/31906


Reviewed-By: default avatarGuy Bedford <guybedford@gmail.com>
Reviewed-By: default avatarMyles Borins <myles.borins@gmail.com>
parent d799c0f1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment