https://juejin.cn/post/7035637086451400734
nodemon经常用来调试js文件,大家都是知道的,但是用nodemon来调试ts文件,大家试过吗? 如果直接运行nodemon index.ts是会报错的。
ts
复制代码
//index.ts console.log(1)

需要全局安装两个包,一个是ts-node,另一个是typescript
js
复制代码
npm i -g ts-node typescript
接着就可以运行nodemon index.ts,不过可能还会报错。

则需要在项目的根目录初始化tsconfig.json,运行:
js
复制代码
tsc --init
然后再运行nodemon index.ts,完美输出。




















