Hot Module Replacement Not Working When Running lando gatsby develop
Doing some experimentation with Gatsby preview and needed a baseline to test against to see if the problem was my app or the module/plugin. This project proved super useful.
Along the way I noticed that if I follow the readme instructions to launch Gatsby in develop mode, the hot module replacement features do not appear to work.
To reproduce:
lando start
cd gatsby
lando gatsby develop --host 0.0.0.0
- Visit https://gatsby.lgd.lndo.site/ in a browser
- Edit the H1 in gatsby/src/pages/index.js
Expected result: The H1 live updates in the browser.
Actual result: Nothing happens.
If I instead wipe out the node_modules folder, npm install
locally, and then run gatsby develop --host 0.0.0.0
locally, HMR works as expected.
Personally, I've only seen reloading work sometimes but not consistently when running gatsby develop within the container. As a result, I usually run it outside. But I get that not doing that is the whole point of this project :) A related Lando issue is here but it hasn't solved the problem for me. Regardless, HMR not working will also prevent Gatsby preview from working.
Related to preview - I'll submit a MR with my branch where Gatsby preview functions when running locally in case it is useful as a reference.