dynamic: `.ts` sources in embedded npm packages are not type-stripped — binary fails with SyntaxError at startup
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- node.js, typescript
- Área
- compilers
Línea de trabajo
Start by reproducing the failure with build --dynamic and the minimal package.json, node_modules/tsdep/index.ts, and main.ts example. Trace how .ts files selected through npm exports enter the embedded npm graph and reach the engine. Done means erasable TypeScript syntax is stripped before execution, or the build emits a diagnostic instead of producing a failing binary.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
build --dynamic succeeds for a program that imports an npm package whose exports point at TypeScript sources (.ts), but the embedded engine receives the .ts source without type stripping. The binary then fails at startup with a SyntaxError on the first type annotation. There's no diagnostic at build time.
This affects real packages that ship .ts entry points. For example [email protected] has "exports": { ".": { "import": "./index.ts" } }, and the binary fails with Uncaught SyntaxError: Unexpected identifier 'AgentToolUpdateCallback' (from import { withFileMutationQueue, type AgentToolUpdateCallback, ... } from "@earendil-works/pi-coding-agent"). #470 fixed the checker side of .ts-shipping dependencies; this is the runtime side.
Reproduction
// package.json
{ "name": "r", "type": "module" }
// node_modules/tsdep/package.json
{ "name": "tsdep", "type": "module", "exports": { ".": { "types": "./index.ts", "import": "./index.ts", "default": "./index.ts" } } }
// node_modules/tsdep/index.ts
export function get(): number { return 42; }
// main.ts
import { get } from "tsdep";
console.log(`${get()}`);
$ scriptc build --dynamic -o ./r main.ts # exit 0
$ ./r
Uncaught SyntaxError: Unexpected token ':'
$ echo $?
1
Variants that fail the same way:
import { value, type Shape } from "lib";givesUnexpected identifier 'Shape'import type { Shape } from "lib";givesfrom clause expected
Expected: .ts modules in the embedded npm graph are type-stripped (erasable syntax, as with tsx / node --strip-types) before they reach the engine. If that isn't supported, the build should fail with a diagnostic instead of producing a binary that can't start.
Versions
Reproduced on scriptc 0.1.7 (npm) and on main at 0d9d946 (built from source), linux-x64-gnu, Node 26.10.0.
- Lenguaje dominante
- TypeScript
- Estrellas
- 5.1k
- Forks
- 130
- Merge medio
- 1 h 13 min
- PR fusionados (30 d)
- 254
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de vercel-labs/scriptc
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
vercel-labs/scriptc#577 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
vercel-labs/scriptc#576 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
vercel-labs/scriptc#522 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
vercel-labs/scriptc#293 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 42/100
vercel-labs/scriptc#265 ·
Los mantenedores suelen responder en 1 día
Todos los issues de vercel-labs/scriptc
Issues similares
-
bug via-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pingdotgg/t3code#14452 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
solana-foundation/program-examples#747 · 1 comentario ·
Los mantenedores suelen responder en 9 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
remotion-dev/remotion#11847 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
openwatersio/slackwater#355 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
melgarafael/DeskcommCRM#1998 · 3 comentarios ·
Los mantenedores suelen responder en 1 día