简体   繁体   English

崇高文字3中的打字稿构建系统无法正常工作

[英]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. 我已经安装了Sublime Text 3,并尝试为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. 正在获取[WinError 2]系统找不到指定的文件。 I tried both the Build System unable to generate the Corresponding JavaScript file. 我尝试了两个构建系统都无法生成相应的JavaScript文件。 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 . 真正让我tsc.cmd是,我需要使用tsc.cmd而不是仅使用tsc The quiet:true just removes the [Finished in 1.6s] that always shows at the bottom of the output window. quiet:true只是删除始终在输出窗口底部显示的[Finished in 1.6s]

TypeScript converts the file to javascript and then the javascript file has to be run so... TypeScript将文件转换为javascript,然后必须运行javascript文件,以便...

  • Make sure you've installed node js and node is in your path. 确保已安装节点js,并且node在路径中。
  • Make sure you've installed TypeScript with npm install -g typescript (the node package manager) and tsc is in your path. 确保已使用npm install -g typescript (节点程序包管理器)安装了TypeScript,并且tsc在路径中。
{
    "cmd": ["tsc.cmd", "$file_base_name.ts", "&&", "node", "$file_base_name.js"],
    "selector": "source.ts, source.tsx",
    "quiet": true
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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