Repository: TypeScript
Issue: Support using --module and --outDir flags in conjunction with --build
Labels: Suggestion,In Discussion

<!-- 🚨 STOP 🚨 𝗦𝗧𝗢𝗣 🚨 𝑺𝑻𝑶𝑷 🚨

Half of all issues filed here are duplicates, answered in the FAQ, or not appropriate for the bug tracker. Please read the FAQ first, especially the "Common Feature Requests" section.

-->

## Search Terms

<!-- List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily -->
--build --module --outDir

## Suggestion

<!-- A summary of what you'd like to see added or changed -->
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

<!--
What do you want to use this for?
What shortcomings exist with current approaches?
-->
In [Aurelia vNext](https://github.com/aurelia/aurelia) 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:
```json
    "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:

```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",
```

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

<!-- Show how this would be used and what the behavior would be -->
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:
* [x] This wouldn't be a breaking change in existing TypeScript / JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. new expression-level syntax)