Use tsx instead of nodemon

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 …


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:


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Jaruwat Thongchana


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Use tsx instead of nodemon." Jaruwat Thongchana | Sciencx - Friday October 7, 2022, https://www.scien.cx/2022/10/07/use-tsx-instead-of-nodemon/
HARVARD
Jaruwat Thongchana | Sciencx Friday October 7, 2022 » Use tsx instead of nodemon., viewed ,<https://www.scien.cx/2022/10/07/use-tsx-instead-of-nodemon/>
VANCOUVER
Jaruwat Thongchana | Sciencx - » Use tsx instead of nodemon. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/10/07/use-tsx-instead-of-nodemon/
CHICAGO
" » Use tsx instead of nodemon." Jaruwat Thongchana | Sciencx - Accessed . https://www.scien.cx/2022/10/07/use-tsx-instead-of-nodemon/
IEEE
" » Use tsx instead of nodemon." Jaruwat Thongchana | Sciencx [Online]. Available: https://www.scien.cx/2022/10/07/use-tsx-instead-of-nodemon/. [Accessed: ]
rf:citation
» Use tsx instead of nodemon | Jaruwat Thongchana | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.