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

Abierto
#3,532 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
build-system

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
6.5k
Forks
212
Merge medio
13 h 46 min
PR fusionados (30 d)
787

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de vercel-labs/scriptc

Todos los issues de vercel-labs/scriptc

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.