Is there any way how to compile TypeScript source files into single JavaScript bundle file?
We've build tool on node.js and TypeScript compilation is performed by
var ts = require('typescript');
...
var program = ts.createProgram(this.getAllInputFileNames(), this.typeScriptOptions, host);
var output = program.emit();
Currently, the typeScriptOptions
is:
{ target: 1, module: 2 }
I was trying to add out
into the typeScriptOptions
so it was
{ target: 1, module: 2, out: 'bundle.js' }
But no luck, the compiler still generates a lot of .js files ...
What option is needed to force TypeScript compiler to compile all input .ts files into single file?
EDIT:
With the above options the compiler generates a lot of .js
files as described above. Also bundle.js
is created but it is empty file.