I'm trying to debug my next.js TypeScript app in a docker container on Windows 10. I cannot seem to get hot module reloading (HMR) to work no matter what I try. I am mounting a volume (as described in #3579), but that still is not working. When I change .tsx files in the mounted volume, nothing happens. Even if I refresh the browser page, nothing happens. The only solution is to completely restart the Express server.
Is there any documentation on how to do this? Is there any way to get visibility into what's happening with the hot reloading? I'm not seeing any errors in the console.
Please post your question on https://spectrum.chat/next-js, as you'll be able to reach more people in the community. The issue template mentions this too btw.
@timneutkens, Sorry, I don't know how I missed that.
No worries 馃檹
In case anyone has the same issue as me, the next.config.js file in https://github.com/thundermiracle/nextjs-hmr did the trick for me. Modifying it slightly to enable TypeScript compiling results in something like this:
const withTypescript = require("@zeit/next-typescript");
module.exports = withTypescript({
webpackDevMiddleware: config => {
config.watchOptions = {
poll: 1000, // Check for changes every second
aggregateTimeout: 300 // delay before rebuilding
};
return config;
},
distDir: "../../.next"
});
Most helpful comment
In case anyone has the same issue as me, the next.config.js file in https://github.com/thundermiracle/nextjs-hmr did the trick for me. Modifying it slightly to enable TypeScript compiling results in something like this: