Discord-Bot-TypeScript-Template
Discord-Bot-TypeScript-Template copied to clipboard
Can we have hot reload?
Hi.
First of all, thanks a lot for this template. It's excellent to have it.
Would it be possible to add a hot reload to it? Would be great if its re-build and re-started automatically.
I tried few implementations, but they wouldn't work:
"dev:hot0": "nodemon --watch src --exec \"npm run dev\"",
"dev:hot1": "concurrently \"npm run build\" \"nodemon --watch src dist/start-bot.js\"",
Both of them stuck after change event triggered. Any ideas what might be wrong?
Hi,
Dependencies:
yarn add -D nodemon ts-node tsc-watch
package.json:
{
"scripts": {
"dev": "tsc-watch --onSuccess \"yarn watch\"",
"dev:manager": "tsc-watch --onSuccess \"yarn watch:manager\"",
"watch": "nodemon --watch './**/*.{ts}' --exec ts-node src/start-bot.ts",
"watch:manager": "nodemon --watch './**/*.{ts}' --exec ts-node src/manager-bot.ts"
}
}
tsconfig.json
{
"compilerOptions": { .... },
"ts-node": {
"esm": true
}
}
Thanks a lot @matheus-caldeira
I like using PM2 so I just added "watch" to the process.json file
"watch": ["dist/"]