microsoft / microsoft/TypeScript
Support using --module and --outDir flags in conjunction with --build
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
Search Terms
--build --module --outDir
Suggestion
I would like to be able to pass --module and --outDir, in --build mode so that I can have multiple npm scripts for different build outputs without needing multiple tsconfig files.
Use Cases
In Aurelia vNext we've fully adopted the new 3.0 build system and are starting to prepare for publishing. We want to publish the build outputs for all different module systems (for all packages) so that consumers can easily point to the one that's compatible with their project.
We have been able to do this pre-3.0 like so:
"build:commonjs": "tsc -m commonjs --outDir dist/commonjs",
"build:amd": "tsc -m amd --outDir dist/amd",
"build:system": "tsc -m system --outDir dist/system",
"build:umd": "tsc -m umd --outDir dist/umd",
"build:es2015": "tsc -m es2015 --outDir dist/es2015",
Now when trying to do this, it doesn't work:
"build:commonjs": "tsc -b -m commonjs --outDir dist/commonjs",
"build:amd": "tsc -b -m amd --outDir dist/amd",
"build:system": "tsc -b -m system --outDir dist/system",
"build:umd": "tsc -b -m umd --outDir dist/umd",
"build:es2015": "tsc -b -m es2015 --outDir dist/es2015",
"build:esnext": "tsc -b -m esnext --outDir dist/esnext",
Results in:
message TS6096: File (...)/packages/runtime/-m' does not exist
message TS6096: File (...)/packages/runtime/commonjs' does not exist
And nothing else happening. I read in the docs that only 4 particular flags are supported in conjunction with --build so it seems this is simply not implemented.
Examples
We'd like to have something like this in the packages package.json:
"build:commonjs": "tsc -b -m commonjs --outDir dist/commonjs",
"build:amd": "tsc -b -m amd --outDir dist/amd",
"build:system": "tsc -b -m system --outDir dist/system",
"build:umd": "tsc -b -m umd --outDir dist/umd",
"build:es2015": "tsc -b -m es2015 --outDir dist/es2015",
"build:esnext": "tsc -b -m esnext --outDir dist/esnext",
"build": "run-p build:*",
And when calling npm run build from the top-level package (using lerna...), that would produce build outputs in all module formats for all packages
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript / JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. new expression-level syntax)
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 esaminando i flag documentati supportati con --build e riproduci il comportamento TS6096 segnalato usando i comandi di esempio. Il lavoro è completato quando --module e --outDir funzionano con --build e producono gli output nel formato di modulo richiesto senza richiedere più file tsconfig.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- build-system
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100