I am running webpack-dev-server
inside of a Docker container. For development purposes, I have a local directory bound to the Docker container. It's my understanding that webpack's standard "watch" abilities don't work inside Docker, or at least with volumes bound to the host machine.
But if I turn on polling (watchOptions.poll: true
), the Docker container uses a lot of CPU. I can turn down polling to 1000ms or even 5000ms, but that still uses non-negligable amounts of CPU, enough so that my laptop's fans start spinning.
Are there any best practices around limiting CPU usage by a polling webpack-dev-server
? Is there anything I can install inside my Linux-based Docker container? I've tried installing the latest inotify-tools
, but that doesn't seem to have done the trick.
for windows 10 2004 and docker desktop wsl2 backend, webpack-dev-server watch work inside docker container volumes bound to the wsl2 directory but does not work volumes bound to the windows directory.
I use vscode with remote-containers extension.
I open \\wsl$\Ubuntu-18.04\home\... by vscode and "reopen in container" by command-pallet.
The solution I used was the docker-sync utility.
It runs in a container and keeps a Docker volume sync'd using rsync. The updates hit Docker's filesystem listener so you can "watch" instead of "polling".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With