nodejs / nodejs/node

doc: Error for "." and ".." specifiers differs from documented Resolver Algorithm

オープン 初心者向け
#39,873 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

doc esm
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

  • Version: ✍️

16.7.0

  • Platform: ✍️

Linux penguin 5.4.119-14945-gafc97d54f809 #1 SMP PREEMPT Tue Aug 10 21:49:04 PDT 2021 x86_64 GNU/Linux

  • Subsystem: ✍️

module

Location

Affected URL(s):

Description

I'm not sure if this is a bug with the ESM resolver or with the docs but basically if we do:

import foo from ".";

Then Node throws a ERR_UNSUPPORTED_DIR_IMPORT error, based on a reading of the Resolver Algorithm I expected this to be ERR_INVALID_MODULE_SPECIFIER.

As CommonJS already treats require(".") and require("..") as directory imports the current behaviour in Node is probably the best, so the docs should be updated to reflect it. This would involve changing ESM_RESOLVE step 3 to:

  • Otherwise, if specifier starts with "/", "./" or "../", or specifier equals "." or ".." then

Although if the current documented behaviour is the intended behaviour then the error needs updating.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされている esm.html セクションの ESM Resolver Algorithm 仕様から始め、手順 3 と "." および ".." に対して観測された import の動作を比較してください。文書化されたアルゴリズムとランタイムの動作のどちらが意図されたものかを確認し、その後、アルゴリズムと報告されたエラーが一致するようにドキュメントを更新してください。文書化された結果が Node の動作と一致した時点で issue は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
backend, documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。