Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we have hot reload? #57

Open
Dizotoff opened this issue Dec 28, 2022 · 3 comments
Open

Can we have hot reload? #57

Dizotoff opened this issue Dec 28, 2022 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Dizotoff
Copy link

Dizotoff commented Dec 28, 2022

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?

@matheus-caldeira
Copy link

matheus-caldeira commented Jan 4, 2023

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
  }
}

@KevinNovak KevinNovak added enhancement New feature or request good first issue Good for newcomers labels Jan 4, 2023
@Dizotoff
Copy link
Author

Dizotoff commented Jan 7, 2023

Thanks a lot @matheus-caldeira

@michael-delle
Copy link

michael-delle commented Jun 17, 2023

I like using PM2 so I just added "watch" to the process.json file

"watch": ["dist/"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants