TypeScript via tsc command: Output to single file without concatenation

Vojtěch picture Vojtěch · Jun 21, 2013 · Viewed 21.8k times · Source

Is there a way of compiling single .ts file to different directory?

The only way from the manual command of compilation to different directory is via --out command, but it also does concatenation of dependent files, which I don't want:

--out FILE|DIRECTORY        Concatenate and emit output to single file | Redirect output structure to the directory

Is there a way of redirecting the output WITHOUT concatenation of input files?

Answer

Alex Filatov picture Alex Filatov · Sep 26, 2016

Unfortunately it's impossible to compile multiple *.ts files into one *.js without concatenation. Because it's impossible on API level of typescript compile options.

See --out option:

DEPRECATED. Use --outFile instead.

Documentation of --outFile option:

Concatenate and emit output to single file. The order of concatenation is determined by the list of files passed to the compiler on the command line along with triple-slash references and imports. See output file order documentation for more details.

All typescript compiler options