From ef87ce4afbee6045808f3464ef4fa30a4cfab2e0 Mon Sep 17 00:00:00 2001 From: Phantom-d-e-v <82759425+Phantom-d-e-v@users.noreply.github.com> Date: Fri, 10 Jul 2026 20:54:31 +0000 Subject: [PATCH] doc: document '.' and '..' specifiers in ESM_RESOLVE algorithm The ESM_RESOLVE algorithm's relative-specifier step only mentioned specifiers starting with '/', './', or '../'. A bare '.' or '..' specifier is also treated as relative and resolves to a directory, throwing ERR_UNSUPPORTED_DIR_IMPORT (see lib/internal/modules/esm/resolve.js isRelativeSpecifier). Document this case so the spec matches the resolver. Fixes: https://github.com/nodejs/node/issues/39873 --- doc/api/esm.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 7bee6777458375..ebe64b8b86270d 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -1022,7 +1022,8 @@ The resolver can throw the following errors: > 2. If _specifier_ is a valid URL, then > 1. Set _resolved_ to the result of parsing and reserializing > _specifier_ as a URL. -> 3. Otherwise, if _specifier_ starts with _"/"_, _"./"_, or _"../"_, then +> 3. Otherwise, if _specifier_ starts with _"/"_, _"./"_, or _"../"_, or +> _specifier_ equals _"."_ or _".."_, then > 1. Set _resolved_ to the URL resolution of _specifier_ relative to > _parentURL_. > 4. Otherwise, if _specifier_ starts with _"#"_, then