What You'll Learn
Beginner
- How to set up hot-reloading for Node.js, Python, and React
- The volume mount trick
docker-compose.ymlyaml
services:
api:
build: .
volumes:
- .:/app # mount source
- /app/node_modules # container's deps
command: npm run dev # nodemonThe /app/node_modules trick
Anonymous volume prevents host's node_modules from overriding container's platform-specific binaries.Key Takeaways
- Hot-reload = bind mount source + file watcher (nodemon, --reload).
- Always add
- /app/node_modules. - Use
CHOKIDAR_USEPOLLING=trueon macOS/Windows. - Changes appear instantly — no rebuild needed.
Comments
Comments
Post a Comment