Nuxt 3 HMR with Docker

952 Views Asked by At

Is HMR throw WSL on Docker working only with server.watch: { usePolling: true } option enabled. It's really make my CPU to be crazy. Anyone try to switch to the Webpack intead of Vite to solve this issue?

P.S. I don't use any 'servers' like nginx, just scaffold nuxt 3 app. And i tried to expose the porst like

ports:
  - 3000:3000
  - 24678:24678 # hmr fix

But in dev. console I get error: [GET] http://localhost:24678/_nuxt/ not found

UPD. As @DavidMaze said in the comments, the simplest solution is just use my host machine for nuxt and docker for other tools.

1

There are 1 best solutions below

0
technoY2K On

Just wanted to follow this up with a solution that worked for me, which was to expose port 24678 in the Dockerfile and setting the ports in compose.yaml.

Dockerfile

...
EXPOSE 3000
EXPOSE 24678

compose.yaml

...
ports:
  - 3000:3000
  - 24678:24678