Skip to content

Commit ef87ce4

Browse files
committed
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: #39873
1 parent 26079c0 commit ef87ce4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

doc/api/esm.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,8 @@ The resolver can throw the following errors:
10221022
> 2. If _specifier_ is a valid URL, then
10231023
> 1. Set _resolved_ to the result of parsing and reserializing
10241024
> _specifier_ as a URL.
1025-
> 3. Otherwise, if _specifier_ starts with _"/"_, _"./"_, or _"../"_, then
1025+
> 3. Otherwise, if _specifier_ starts with _"/"_, _"./"_, or _"../"_, or
1026+
> _specifier_ equals _"."_ or _".."_, then
10261027
> 1. Set _resolved_ to the URL resolution of _specifier_ relative to
10271028
> _parentURL_.
10281029
> 4. Otherwise, if _specifier_ starts with _"#"_, then

0 commit comments

Comments
 (0)