javascript - Run Nodemon with Typescript compiling?
问题描述
I want my typescript files to be compiled on every file saving with the command tsc
.
How do I combine the tsc command with the command that nodemon runs in the build:live
script
"scripts": {
"start": "npm run build:live",
"build:live": "nodemon --watch '*.ts' --exec 'ts-node' app.ts",
}
this script causes nodemon to call itself twice or three times:
"build:live": "nodemon --watch '*.ts' --exec 'ts-node app.ts & tsc'",
解决方案
Nodemon will detect and run .ts
files with ts-node
automatically now. It will actually run .py
and .rb
files with python and ruby too btw and you can give it a custom --exec
for others. Here's a link to the relevant code within nodemon.
So the following should be fine:
"scripts": {
"dev": "nodemon app.ts"
}
推荐阅读
- mysql - MYSQL DATETIME 列上的条件未按预期工作
- c# - 如何通过将失败消息发布到 .NET 中的死信主题来实现 kafka 重试策略?
- ios - Xamarin 社区工具包 MediaElement 不播放流中的视频
- google-cloud-platform - 使用 3rd 方 VPN 连接到私有 GKE 集群
- javascript - 从组件外部更新状态
- c++ - 是否有一种有效的方法来检查正在使用的字母?
- node.js - 如何防止 Electron 应用程序网络请求显示在像 Charles 这样的代理调试器工具中?
- git - 过滤某些文件扩展名的 git diff 输出
- excel - 使用 Excel VBA 打开 word 文档时出现运行时错误
- sql - Oracle数据库中的null等于null吗?