Open junjielyu13 opened 1 year ago
It is absurd that nest is so buggy for something so essential and yet so simple as hot reloading when using docker...
I was thinking about using nodemon and this worked perfectly.
since I am using the setup with nestjs monorepo, I pass the main.ts
path as a parameter to the command:
package.json
"nodemon": "nodemon --legacy-watch -x ts-node"
docker-compose
command: npm run nodemon -- apps/orders/src/main.ts
I notice moduleNameMapper
is no longer working though. Not sure why, but I am fine without it.
I solved the problem by replacing "typescript": "^4.7.4" to "typescript": "~4.7.4" and npm install again locally. I don't now what is the bug.
I had the same issue. Fixed by updating start:dev command in package.json with
"start:dev": "nest start --tsc --watch"
and adding watch options in tsconfig.json
"watchOptions": {
"watchFile": "fixedPollingInterval"
}
I saw your issue https://github.com/nestjs/nest/issues/11010 and I encountered the same problem, start:dev can't run in docker, I ended up using nodemon instead of star:dev
This might not be the best way, but it works! !
make some changes on scripts in the package.json file:
npm install typescript @types/node ts-node nodemon -D
"start:dev": "nest start --watch"
to"start:dev": "nodemon --legacy-watch -x ts-node src/main.ts"
"nodemon": "nodemon --legacy-watch -x ts-node src/main.ts"
there is a reference:
Hope this helps you