0

I want to use different flags (sourcemap, out, target) that the typescript compiler provides. I am trying to define a build system in sublime 2 but unable to do so. Have already read this question.

basically i want to do something like the following

tsc src/main/ts/myModule.ts --out src/main/js/myModule.js --sourcemap --target ES5 

2 Answers 2

0

Just add them to the cmd array

{
    "cmd": ["tsc","$file", "--out", "src/main/js/myModule.js"],
    "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
    "selector": "source.ts",
    "osx": {
       "path": "/usr/local/bin:/opt/local/bin"
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

this doe not work for me...also i am trying to do this on windows
0

First of all let me say that I'm using Sublime Text 3 on Windows and Typescript 1.0. I don't think that SublimeText2 is so much different, though...

If you're on similar conditions, take a look at my current configuration file:

{
  "cmd": ["tsc", "$file"],
  "file_regex": "(.*\\.ts?)\\s*\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(.+?)$",
  "selector": "source.ts",

  "windows": {
    "cmd": ["tsc.cmd", "$file", "--target", "ES5"]
  }
}

Please notice that I tweaked the regex so that it matches the TSC error format (and brings you to the line containing the error when you double click it from the error log...)

Besides of that, I think that the real command-line which gets run is the lower one: as a matter of fact I had it working only placing the options down there... (in this specific case I'm asking an ES5 compilation type, your parameters will differ).

This suppose you have a tsc.cmd avaliable on path; if not, put the full path of tsc.cmd or tsc.exe instead of "tsc.cmd" and be sure to escape backslashes \ as \\...

This works in my situation, maybe in other contexts they should also be placed on the first line...

Hope this helps :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.