NodeJS/TypeScript: Einfaches Auto-Reload bei Dateiänderung

English Deutsch

Installiere zuerst ts-node-dev:

npm i –save-dev ts-node-dev

install_tsnd.sh
npm i --save-dev ts-node-dev

Füge dann

package.json.snippet
"start": "./node_modules/.bin/tsnd --respawn app.ts"

zur package.json im scripts-Abschnitt hinzu, Beispiel:

package.json.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