doc: Error for "." and ".." specifiers differs from documented Resolver Algorithm
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
- 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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der Spezifikation des ESM Resolver Algorithm im verlinkten Abschnitt esm.html und vergleichen Sie Schritt 3 mit dem beobachteten Importverhalten für "." und "..". Bestätigen Sie, ob der dokumentierte Algorithmus oder das Laufzeitverhalten beabsichtigt ist, und aktualisieren Sie anschließend die Dokumentation, sodass der Algorithmus und der gemeldete Fehler übereinstimmen; das Issue ist abgeschlossen, wenn das dokumentierte Ergebnis mit dem Verhalten von Node übereinstimmt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js
- Bereich
- backend, documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 68/100