dynamic: `.ts` sources in embedded npm packages are not type-stripped — binary fails with SyntaxError at startup
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- compilers
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 183
- Merge medio
- 2h 10m
- PR unite (30g)
- 884
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi 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.
Altre issue di vercel-labs/scriptc
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 53/100
vercel-labs/scriptc#1376 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
vercel-labs/scriptc#1374 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
vercel-labs/scriptc#1373 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
vercel-labs/scriptc#1372 ·
I maintainer di solito rispondono entro 1 giorno
-
Clarify compilation pipeline stages, partition thresholds, and build performance in documentationForse già presa @espetro l’ha presa 1 giorno fa. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 25/100
vercel-labs/scriptc#1340 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vercel-labs/scriptc
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jessepollak/home#2223 ·
I maintainer di solito rispondono entro 1 giorno
-
grep fixture corpus test follows the corpus's loop symlink under the receipt runner (fails on main)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
code-yeongyu/senpi#3756 ·
I maintainer di solito rispondono entro 1 giorno
-
org:external package:deepagents priority:triage topic:memory topic:middleware type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
langchain-ai/deepagents#7059 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
osmlab/name-suggestion-index#12992 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
hemilabs/ui-monorepo#2506 ·
I maintainer di solito rispondono entro 1 giorno