Skip to content

Can we have hot reload? #57

@Dizotoff

Description

@Dizotoff

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?

Activity

matheus-caldeira

matheus-caldeira commented on Jan 4, 2023

@matheus-caldeira

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

Dizotoff commented on Jan 7, 2023

@Dizotoff
Author

Thanks a lot @matheus-caldeira

michael-delle

michael-delle commented on Jun 17, 2023

@michael-delle

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @michael-delle@Dizotoff@KevinNovak@matheus-caldeira

        Issue actions

          Can we have hot reload? · Issue #57 · KevinNovak/Discord-Bot-TypeScript-Template