gpt4 book ai didi

typescript - 如何在 sublime Text 3 的一次构建中编译 TypeScript 并运行结果 .js 文件?

转载 作者:搜寻专家 更新时间:2023-10-30 21:12:43 31 4
gpt4 key购买 nike

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

enter image description here

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

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

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

最佳答案

假设 tscnode 都在您的系统 PATH 中,以下配置应该有效:

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

参见 Build Systems – Configuration有关这里发生的事情的更多信息。

关于typescript - 如何在 sublime Text 3 的一次构建中编译 TypeScript 并运行结果 .js 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39533946/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com