Should literal dynamic import('pkg') follow into the module graph?

Aperta
#3,532 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
build-system

Direzione di ricerca

Start by reading the dynamic import handling that emits SC2013, then compare it with static import graph construction and the related issue #363 and corpus case 9537. The issue asks whether literal dynamic imports should enter the module graph, including package type handling and evaluation or interop constraints; done means resolving that design question and implementing the agreed behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

scriptc 0.4.11, main at 918d80b26a, macOS arm64.

Question: should a literal import("pkg") follow into the module graph like a static import?

const m = await import("ms");
console.log(m.default(1000));

With no static import of ms, the build refuses with SC2013 and the package is not compiled. A literal specifier is statically known, so it could be added to the graph the same way a static import is, with the namespace typed from the package types. Is that feasible, or is there a blocker (evaluation order, conditional loading, ESM/CJS interop)? Related: #363 and corpus case 9537.

PR #3527 improves the diagnostic meanwhile: it names the package (not @types/ms) and hints at adding a static import.

Lingua principale
TypeScript
Stelle
6.5k
Fork
212
Merge medio
13h 46m
PR unite (30g)
787

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel-labs/scriptc

Tutte le issue di vercel-labs/scriptc

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.