Use tsx instead of nodemon

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 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:

Total
1
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
web-scraping-google-play-movies-&-tv-with-nodejs

Web scraping Google Play Movies & TV with Nodejs

Next Post
use-react-context-for-auth

Use React Context for Auth

Related Posts