【问题标题】:How to compile TypeScript and run the result .js file in one build in sublime Text 3?如何在 sublime Text 3 的一次构建中编译 TypeScript 并运行结果 .js 文件?
【发布时间】:2017-01-24 19:52:12
【问题描述】:

我已经在 Sublime Text 3 上成功安装了 TypeScript 插件。插件安装后,它的菜单中添加了一个构建系统。

您可以只使用“Command + B”来构建 .ts 文件。

我想要的是将 .ts 编译为 .js 并在一个“Command + B”命令中使用“node xxx.js”运行结果 js 文件。

如何配置 sublime text 3 构建系统来做到这一点?

【问题讨论】:

    标签: typescript sublimetext3


    【解决方案1】:

    假设tscnode 都在您的系统PATH 中,那么以下配置应该可以工作:

    {
      "cmd": ["tsc $file && node $file_base_name.js"],
      "shell": true,
      "selector": "*.ts"
    }
    

    请参阅Build Systems – Configuration 了解更多关于这里发生的事情。

    【讨论】:

      猜你喜欢
      • 2014-08-05
      • 2014-02-07
      • 2019-03-19
      • 1970-01-01
      • 2016-05-29
      • 1970-01-01
      • 1970-01-01
      • 2016-06-18
      • 1970-01-01
      相关资源
      最近更新 更多