-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
watch
mode in node.js 20
doesn't watch changes in non-entry files
#246
watch
mode in node.js 20
doesn't watch changes in non-entry files
#246
Comments
This comment was marked as spam.
This comment was marked as spam.
1 similar comment
This comment was marked as spam.
This comment was marked as spam.
I think it might be related to a bug in Chokidar, see vitejs/vite#12495 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Found a temporary solution by using tsx as a loader instead: node --watch --loader=tsx index.ts |
If anyone is able to, please investigate what's causing this. If it's chokidar, is there an issue tracked in their repository? We can consider swapping to a different watcher. |
I am using Node 20 in Windows and it seems to be working fine. |
Experiencing identical issues on Linux. thopop@Latitude5490: ~ $ uname -r
6.4.1-zen2-1-zen
thopop@Latitude5490: ~ $ node -v
v20.3.1
I don't know why that works for you, but not using tsx directly gives me following error: > tsc --build && dotenv -e .env.dev node --watch --loader=tsx src/server.ts --inspect=0.0.0.0:%SERVER_PORT%
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /usr/src/app/projects/backend/auth-service/src/server.ts Edit: Does work as you described. I had an error in my command. (Missing -- after dotenv -e .env.dev) |
I don't think this is caused by chokidar, but a change to IPC that affects It appears as if we don't receive dependency messages from the runProcess.on('message', (data) => {
console.log("received", data); console.log("sending esm", url, "process.send", process.send);
if (process.send) { console.log("sending cjs", filePath, "process.send", process.send);
if (process.send) { This gives the following outputs (on macOS): Node 18.17.0
Node 20.5.0
In this case, no I looked for causes and found this change to the loader API that might be related. In a github issue that discusses a seemingly similar case, it was suggested that Hope this is helpful! |
Wow thank you so much for the insightful investigation @fspoettel |
Wrote a fix esbuild-kit/esm-loader#64 based on @fspoettel research. Working well for me, but can somebody test it in him configurations also too? @privatenumber, waiting for review. |
Bug description
watch
mode works on node.jslts/hydrogen
v18, but doesn't on20+
.Reproduction
tsx watch file-1.ts
file-2.ts
no rerun
bytsx
Environment
System: OS: MacOS (currently latest 13.3) CPU: m1 pro Shell: zsh Binaries: Node: 20.1.0 npmPackages: tsx: `3.12.7` (current latest)
Can you work on a fix?
The text was updated successfully, but these errors were encountered: