NodeJS typescript simple auto-reload on file change
First install ts-node-dev:
npm i –save-dev ts-node-dev
install_tsnd.sh
npm i --save-dev ts-node-dev
Then add
package.json.snippet
"start": "./node_modules/.bin/tsnd --respawn app.ts"
to package.json
in the scripts
section, example:
example.json
{
"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"
}
/* ... */
}
Check out similar posts by category:
Javascript, NodeJS
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow