Use tsx instead of nodemon
Jaruwat Thongchana
Posted on October 7, 2022
If you use typescript, nodemon and ts-node 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 ts-node.
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:
💖 💪 🙅 🚩
Jaruwat Thongchana
Posted on October 7, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.