wclr / ts-node-dev

Compiles your TS app and restarts when files are modified.
MIT License
3.43k stars 123 forks source link

hotreload (--respawn) not working inside docker container #344

Open CorentinTrt opened 7 months ago

CorentinTrt commented 7 months ago

Issue description

Hello, i'm trying to run a node dev environment with tsnd. I'm using Docker

The hot reload feature (using --respawn) is not working while running inside the docker container. However, everything's working while running on the host machine

There is a volumes mounted between the host machine and the container and the code is correctly updated inside the docker container (with docker compose)

Here is the command that i run: "tsnd -r tsconfig-paths/register --env-file=common/environment-variables/development/.env --respawn src/entrypoint.ts"

Here is my Dockerfile:

FROM node:20.11.0
LABEL authors="@hooma"

WORKDIR /srv/authentifier-service

COPY --link . ./

RUN npm install pnpm -g

RUN pnpm install

CMD "pnpm" "run" "dev:run"

Context

OS version (is it docker or host?), ts-node-dev version

Did you try to run with ts-node? NO

Did you try to run with --files option enabled? NO

Did you try to run with --debug option enabled? NO

Do you have a repro example (git repo) with simple steps to reproduce your problem? I can provide it if necessary but I don't want to commit non working code if possible

sentientmachin3 commented 4 months ago

I'm having the very same issue using the command ts-node-dev --respawn --transpile-only ./src/index.ts. Did you find a solution @CorentinTrt ?

CorentinTrt commented 4 months ago

Hello, no, I changed my approach, using nest which use webpack and ts-loader if I remember correctly.

But could be interesting to have an insight from the team. I'd go with some issue related to the volumes and the paths in the file system but I didn't dig at all.

Hope you'll find a solution!