NodeJS typescript simple auto-reload on file change
First install ts-node-dev:
npm i --save-dev ts-node-dev
Then add
"start": "./node_modules/.bin/tsnd --respawn app.ts"
to package.json
in the scripts
section, example:
{
"name": "myapp-backend",
"version": "1.0.0",
"description": "To make it easy for you to get started with GitLab, here's a list of recommended next steps.",
"main": "index.js",
"scripts": {
"build": "./node_modules/.bin/tsc -b tsconfig.json",
"start": "./node_modules/.bin/tsnd --respawn app.ts"
}
/* ... */
}