doc: Error for "." and ".." specifiers differs from documented Resolver Algorithm
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
- 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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la specifica di ESM Resolver Algorithm nella sezione esm.html collegata e confronta il passaggio 3 con il comportamento osservato degli import per "." e "..". Conferma se è previsto l'algoritmo documentato o il comportamento del runtime, quindi aggiorna la documentazione in modo che l'algoritmo e l'errore riportato concordino; l'issue è completata quando il risultato documentato corrisponde al comportamento di Node.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, node.js
- Ambito
- backend, documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 68/100