watch mode not working with git worktree
Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.0.0
Plugin version
No response
Node.js version
16.17.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
20.04
Description
At #547, I mistakenly assumed that watch mode was not working because of esm, in fact, watch mode is not working if the project is in the git worktree.
If you use typescript, then typescript rebuilds the project, but the server still does not restart.
Steps to Reproduce
git clone https://github.com/railwayapp-templates/fastify --bare
cd fastify.git
git worktree add main
cd main
npm i
npm run dev
change any file -> typescript rebuild -> server does not restart
Expected Behavior
No response
What's special with worktree that breaks this? We just use normal OS file watching.
I'm not sure what the problem is, so far I'm using nodemon. It works with worktree.
I couldn't reproduce this on my end, I followed the steps you listed.
My environment:
- OS → Windows 10 (21H1)
- Node Version → 16.17.0
- Fastify-CLI Version → 5.4.2
I think the source of the issue starts from here: https://github.com/nodejs/node/issues/36005
and leads to the chokidar module's funding
If we drop that module, we should go for the node:fs.watch one