Reputation: 16845
I am using TypeScript Node NPM module to compile my .ts
files in my project.
As for documentation (that is condensed in the NPM page the link I reported above leads to), when compiling a simple file, I just need to:
node node_modules/typescript/bin/tsc.js main.ts
However, I need to pass parameters to the compiler, so I do this:
node node_modules/typescript/bin/tsc.js main.ts --module commonjs --out out/main.js
But it looks like the --module commonjs --out out/main.js
part is not considered and gets lost.
How to successfully pass parameters to tsc.js
invoked through 'node'? Thanks
Upvotes: 1
Views: 3023
Reputation: 276299
it looks like the --module commonjs --out out/main.js part is not considered and gets lost.
Not true. It works fine. Most probably the thing you are experiencing:
--module
and --out
togetherBasically don't use --out
. For your use case (to redirect output to a different directory) use --outDir
.
Personally, I dislike out
for beginners : https://github.com/TypeStrong/atom-typescript/blob/master/docs/out.md
Upvotes: 3
Reputation: 2022
By installing typescript with
npm install -g typescript
you should get also the command line compiler (tsc
) that you can invoke like you were doing
tsc main.ts --module commonjs -out out/main.js
what you were trying to execute is probably not taking the arguments at all (did you build typescript from source?), all compilation should be done with tsc
. Even the tutorial suggests doing so, and you can find more examples in the handbook.
Upvotes: 0