How to Watch and Reload ts-node When TypeScript Files Change?

Restart ts-node automatically when your .ts files change using nodemon or ts-node-dev. Enhance your TypeScript workflow in real time.

Use ts-node-dev or nodemon with ts-node to auto-reload your app on TypeScript file changes. It’s faster and no more manual restarts.

Problem

When using ts-node in dev, any .ts file changes require manual restart of the process. That slows down development and breaks the flow.

Solution

To auto-reload your Node.js server when .ts files change, pair ts-node with a watcher like nodemon or ts-node-dev.

Option 1- ts-node-dev

bash
npm install -D ts-node-dev
Add script in package.json:

json

"scripts": {"dev": "ts-node-dev --respawn --transpile-only src/index.ts" }
Run:

bash

npm run dev
Also Read: Node JS Best Practices to Adhere for Enhanced Performance & Security

Option 2- nodemon with ts-node

Install nodemon:

bash

npm install -D nodemon ts-node
Add script:

json

"scripts": {"dev": "nodemon --watch src -e ts --exec ts-node src/index.ts" }

Conclusion

For fast dev, use ts-node-dev or nodemon with ts-node to auto-reload your app on file changes.
Related

How to Get the Project Root Path in Node.js When working with large Node.js projects, you often need to find the root directory at runtime…

15 Oct, 2025

If you’re trying to run nodemon from the terminal and see the error: nodemon: command not found, it usually means the nodemon package is not…

10 Oct, 2025

Writing to files is a common task in Node.js, whether for logging, saving uploads or creating reports. Node.js has various methods through the built-in fs…

07 Oct, 2025
Request a Quote Schedule a Meeting