-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Description
Version
v20.13.1
Platform
Darwin chaos.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
1) Create a TS app with an index.js, ts-node to use as loader, and a module to preload
mkdir testapp
cd testapp
echo "console.log('Hello World!');" > index.ts
npm i --save ts-node
npm i --save dotenv-flow2) Launch one of the following commands
node --watch --loader ts-node/esm ./index.ts
node --watch -r 'dotenv-flow/config' ./index.tsHow often does it reproduce? Is there a required condition?
It can be reproduced deterministically with the steps outlined above on version 20.13.
The condition required to reproduce it is to put --watch as the first option.
If you run the following, the bug is not present:
node --loader ts-node/esm --watch ./index.ts
node -r 'dotenv-flow/config' --watch ./index.tsThe error seems to not be present neither in 20.12 nor in >=21: it happens only on 20.13 / 20.13.1
What is the expected behavior? Why is that the expected behavior?
The program should run, print Hello World!, then remain in watch mode waiting for file changes.
What do you see instead?
Error: Cannot find module - node seems to not look for modules in the node_modules folder.
Additional information
No additional info.