I have a project written in TypeScript and I use a task runner for building (whatever: Gulp, Jake, etc.). The TypeScript piler i use is the one I installed from NPM:
npm install typescript
Important: As you can see there is no global -g
parameter and this is on purpose. As I need to use a specific version of the piler with some modifications.
Calling tsc
programmatically
So I want to invoke the piler from my Javascript file configuring my task manager:
var tsc = require("typescript");
function pile() {
tscpile(...); // I would like to do something like this
}
Can I do that? I have tried, but not getting much luck so far.
I have a project written in TypeScript and I use a task runner for building (whatever: Gulp, Jake, etc.). The TypeScript piler i use is the one I installed from NPM:
npm install typescript
Important: As you can see there is no global -g
parameter and this is on purpose. As I need to use a specific version of the piler with some modifications.
Calling tsc
programmatically
So I want to invoke the piler from my Javascript file configuring my task manager:
var tsc = require("typescript");
function pile() {
tsc.pile(...); // I would like to do something like this
}
Can I do that? I have tried, but not getting much luck so far.
Share Improve this question edited Aug 12, 2016 at 21:29 Andry asked Aug 12, 2016 at 21:17 AndryAndry 16.9k30 gold badges156 silver badges265 bronze badges 2- Have a look at gulp-typescript – Aleksey L. Commented Aug 14, 2016 at 5:19
- I think this is what you are looking for – Jthorpe Commented Jan 22, 2022 at 0:53
1 Answer
Reset to default 6You sure can. There are numerous tools - tsify
, ts-node
, ts-loader
- that are built using the TypeScript Compiler API.
However, it's a little bit more plicated than a single pile
call.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744800513a4594462.html
评论列表(0条)