简体   繁体   English

有没有办法通过单击 VSCode 上的按钮/快捷方式同时运行“tsc -watch”和“npm start”?

[英]Is there a way to run “tsc -watch” and “npm start” at the same time, with a click of a button/ shortcut on VSCode?

I am new to node.js and typescript, and I was wondering whether there is any way to run those two commands at the same time with the click of a button or command on visual studio code.我是 node.js 和 typescript 的新手,我想知道是否有任何方法可以通过单击 Visual Studio 代码上的按钮或命令同时运行这两个命令。

Thank you谢谢

You can execute a command via a click by clicking on the "npm scripts" tab shown on your left hand side (default)您可以通过单击左侧显示的“npm 脚本”选项卡来执行命令(默认)

npm 脚本

If you want to execute multiple commands in single click you have to use something like concurrently如果要单击执行多个命令,则必须同时使用类似的东西

open you package.json and edit script打开你 package.json 并编辑脚本

"script" : {
  "my-script": "concurrently \"tsc-watch\" \"npm start\""
}

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

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