【问题标题】:Nodemon ts-node can't watch for JavaScript changesNodemon ts-node 无法监视 JavaScript 更改
【发布时间】:2019-12-24 23:07:44
【问题描述】:

这是我的 nodemon.json:

{
  "watch": ["src"],
  "ext": "ts",
  "ignore": ["src/**/*.spec.ts"],
  "exec": "ts-node ./src/index.ts"
}

我的项目既有 js 文件又有 ts 文件,我希望它也能观察 js 文件的变化,但它只会在我更改 index.ts 时重新启动

【问题讨论】:

    标签: javascript node.js typescript nodemon ts-node


    【解决方案1】:

    试试下面的nodemon.json

    {
      "watch": ["src"],
      "ext": "js,ts",
      "ignore": ["src/**/*.spec.ts"],
      "exec": "ts-node ./src/index.ts"
    }
    

    【讨论】:

    • 啊,我试着把它放在一个数组 ["js,ts"] 中,这就是我收到错误的原因。这行得通。谢谢。
    猜你喜欢
    • 2017-12-13
    • 1970-01-01
    • 2018-06-03
    • 2020-02-26
    • 2016-02-29
    • 1970-01-01
    • 2014-12-11
    • 2015-11-14
    • 2015-08-27
    相关资源
    最近更新 更多