Member-only story
TSX vs. TS-Node and Nodemon
Which NodeJS runner is fastest for typescript?
A developer asked the following question on StackOverflow:
How to watch and reload ts-node when TypeScript files change
This article is my answer to that question, with a clear comparison to the leading alternative, tsx
. I also include my tsconfig.json
and the exact packages I'm using in this setup.
In 2024, ts-node
with nodemon
is consistently 3 times faster than tsx
in a large project, such as the one I use to run ManyStories.com and OurTransfers.com for over a million visitors and customers per year.
I wanted tsx
to be faster since it's so much simpler, but it unfortunately is not. I had to change to ts-node after a couple of weeks of wasted time waiting half a minute after every code change for tsx
to recompile my code.
I ran the following two scripts:
"scripts": {
"dev-server-tsx": "date && tsx watch --clear-screen=false ./src/serverInstance.ts",
"dev-server-nodemon": "date && nodemon ./src/serverInstance.ts",
}
with these packages:
"nodemon": "^3.1.7",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tslib": "^2.8.0",
"tsx": "^4.19.1",