How to watch ts,js,graphql extensions in ts-node-dev?

476 views Asked by At

I am trying to run the node server by ts-node-dev and restart on any any changes in specific files. It is restarting on any changes made to ts,js files however, it is not restarting on changes to graphql files. Any suggestions?

  "scripts": {
    "start": "tsnd --transpile-only --rs ./src/microservices/index.ts --watch--extionsions 
 ts,js,graphql"
  }
1

There are 1 answers

0
BrinkDaDrink On

The syntax for --watch is different than nodemon and others that allow just a list of extensions. Here is more regex matching.

I also noticed you do not need to include the standard files it already watches. Based on the github issue where I found the solution you need to put --watch before the final entry point

In order to watch for .graphql files you need to add

--watch ./**/*.graphql

So your example should be:

"scripts": {
    "start": "tsnd --transpile-only --rs --watch ./**/*.graphql ./src/microservices/index.ts"
  }