This content originally appeared on DEV Community 👩💻👨💻 and was authored by Jaruwat Thongchana
If you use typescript, nodemon and tsnode for development.
You'll notice that it takes a while to recompile the code when it changes.
tsx is a Typescript execute which blazing fast ⚡️ with esbuild.
Installation
I prefer use pnpm but you can use npm, yarn, ...etc.
pnpm add -D tsx
Now you can uninstall nodemon and tsnode.
pnpm remove nodemon ts-node
Add script tsx watch [file/folder]
in the package.json.
{
"name": "use-tsx",
"version": "1.0.0",
"main": "index.ts",
"scripts": {
"dev": "tsx watch src",
},
"devDependencies": {
"@types/node": "^18.7.18",
"tsx": "^3.9.0",
"typescript": "^4.8.3",
}
}
Let's start.
pnpm dev
refs:
- https://github.com/esbuild-kit/tsx
- https://github.com/privatenumber/ts-runtime-comparison
- https://github.com/remy/nodemon
- https://github.com/TypeStrong/ts-node
This content originally appeared on DEV Community 👩💻👨💻 and was authored by Jaruwat Thongchana

Jaruwat Thongchana | Sciencx (2022-10-07T15:21:49+00:00) Use tsx instead of nodemon. Retrieved from https://www.scien.cx/2022/10/07/use-tsx-instead-of-nodemon/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.