wclr / ts-node-dev

Compiles your TS app and restarts when files are modified.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: how can I trigger a respawn if my a dependency changes?

SpencerKaiser opened this issue · comments

Issue description

I'm using a mono repo with multiple packages via Yarn Workspaces

When a dependency package changes (/packages/utils for example), how can I trigger a restart in my core app?

Here's my dev script:

"dev": "ts-node-dev --exit-child --watch .env.local --files --rs --respawn src/index.ts",

If I modify a dependency package, I can see the change trigger in node_modules but my app isn't restarting. I've tried:

  • Adding node_modules to my --watch
  • Modifying my tsconfig
  • Using --debug to see if a file change occurred but was being ignore for some reason

Context

OS version (is it docker or host?), ts-node-dev version
macOS Ventura 13.4 (22F66)
ts-node-dev "^2.0.0"

Did you try to run with ts-node?
N/A

Did you try to run with --files option enabled?
Yes

Did you try to run with --debug option enabled?
Yes

Do you have a repro example (git repo) with simple steps to reproduce your problem?
No but I can create one if needed

So after digging through my debug logs I realized the file I want watched wasn't being added as a watched file... I then realized that was because I was only importing types; is that expected behavior? I suppose that's more of a question for the ts-node team but still