Yes, you can run tsc --watch and nodemon together using npm scripts. This is a common setup for TypeScript projects because it allows the TypeScript compiler to automatically rebuild your code while nodemon restarts the Node.js application whenever the compiled JavaScript changes.
The easiest way to achieve this is by using a utility such as concurrently or npm-run-all, which lets multiple scripts run in parallel from a single command.
A typical workflow looks like this:
tsc --watchcontinuously compiles TypeScript files into JavaScript.nodemonwatches the compiled output directory (usuallydist) and restarts the server whenever a new build is generated.- Running both together gives you a smooth development experience without manually rebuilding or restarting the application.
A few best practices:
- Configure
nodemonto watch the compiled JavaScript output rather than the TypeScript source files. - Keep your compiled files in a separate directory (such as
dist) to avoid unnecessary restarts. - Enable source maps in your TypeScript configuration if you need easier debugging.
- Exclude folders like
node_modulesand build artifacts that don’t need to trigger restarts.
If you’re using a newer development setup, you might also consider tools like tsx, ts-node-dev, or nodemon with ts-node, which can execute TypeScript directly and often eliminate the need for a separate compilation step during development.
For most projects, however, running tsc --watch alongside nodemon remains a reliable and widely used workflow because it closely mirrors how the application is built and run in production.

Be the first to post a comment.