microsoft / microsoft/TypeScript
Support using --module and --outDir flags in conjunction with --build
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
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)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, die dokumentierten, mit --build unterstützten Flags zu prüfen, und reproduziere das gemeldete TS6096-Verhalten anhand der Beispielbefehle. Erledigt ist die Aufgabe, wenn --module und --outDir mit --build funktionieren und die angeforderten Ausgaben im Modulformat erzeugen, ohne mehrere tsconfig-Dateien zu erfordern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- build-system
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100