medienhaus / medienhaus-docker

The medienhaus/ Docker composition
https://medienhaus.dev/
GNU Affero General Public License v3.0
0 stars 0 forks source link

fix: detect next.config.js changes and automatically reload #7

Closed fnwbr closed 8 months ago

fnwbr commented 8 months ago
image

Before this change the Docker container running npm run dev would not detect changes being made to the next.config.js file.

Unlike the bundled hot reload of actual app files (like code in /pages, /lib, ...) Next.js uses Watchpack to watch for file changes inside the config file: https://github.com/vercel/next.js/blob/62ab0e33a2988989c67b9b7e429874d4cbc0473f/packages/next/src/server/lib/start-server.ts#L336-L359

For some reason those file changes are only being recognized inside of the Docker container when making Watchpack poll for file changes.

(This probably varies depending on what filesystem driver is being used; OrbStack and Docker Desktop might use different approaches here. But with this change all systems should be happy; and polling every 1000ms is just fine; this is not a file expected to be changed very often.)