DEV Community


Hot Reload Typescript with ts-node-dev

husnaramadan profile image Husna Ramadan ・1 min read

Hi, folks!

To learn essenstial Typescript i should see the result of my code. And, cause i don't want to running command repeatdly, i use this single tool ts-node-dev by Alex.

This tool is faster ⚡⚡ than any other, like nodemon.

First, install your ts-node-dev

sudo npm i ts-node-dev -g

-g or --global flag for install it globally, if you're going to want it you should add sudo command for user invoke access root.

You have got it 😤

In your package.json on section below "script": add hot reload command, like this:

"scripts": {
    "dev": "ts-node-dev --respawn src/index.ts"
Enter fullscreen mode Exit fullscreen mode

On the dev section you just set your main file scr/index.ts and --respawn flag itself for restarts the node target.

And, look at my result of ts-node-dev 😎😎

Oh, I forgot. This solution from here

Discussion (0)

Editor guide