简体   繁体   中英

Build System for typescript in sublime text 3 is not working

I have installed Sublime Text 3 and trying to create the build system for TypeScript. Below are the code I am using

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

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

{
    "cmd": ["tsc", "-d", "-m", "amd", "--sourcemap", "$file"],
    "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
    "selector": "source.ts",
    "osx": {
       "path": "/usr/local/bin:/opt/local/bin"
    },
    "windows": {
        "cmd": ["tsc", "-d", "-m", "amd", "--sourcemap", "$file"]
    }
}

Getting [WinError 2] The system cannot find the file specified. I tried both the Build System unable to generate the Corresponding JavaScript file. Can anyone help me on this. Thanks in advance.

For anyone still trying to figure this out, this is all I needed. The thing that really got me was that I needed to use tsc.cmd instead of just tsc . The quiet:true just removes the [Finished in 1.6s] that always shows at the bottom of the output window.

TypeScript converts the file to javascript and then the javascript file has to be run so...

  • Make sure you've installed node js and node is in your path.
  • Make sure you've installed TypeScript with npm install -g typescript (the node package manager) and tsc is in your path.
{
    "cmd": ["tsc.cmd", "$file_base_name.ts", "&&", "node", "$file_base_name.js"],
    "selector": "source.ts, source.tsx",
    "quiet": true
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM