The tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}
The scrips in the package.json:
"scripts": {
"build": "tsc -p tsconfig.json"
},
There are two files the source: src/index.ts and the output: dist/index.js.
There is nodemon installed.
So I can build the index.ts by command:
npm run build
I can run nodemon which watchs for output dist/index.js changes:
nodemon --inspect-brk dist/index.js
How do I setup nodemon to make it watch for changes in index.ts and make it run build command when index.ts is changed?