Reputation: 4323
When I run app with gatsby develop
and then change the source code gatsby will try to update the app without full page reload which is theoretically faster than page reload. But sometimes it may throw an error and I will be forced to reload page.
In my case it throws an error almost all the time and because of this I spend more time waiting for error to display and then manually refresh the page (error will disappear because it was caused by "fast" page update in the first place). So, how to tell gatsby to refresh the page for me (like CRA wit default webpack config does)?
Upvotes: 2
Views: 1425
Reputation: 21
Which worked for me was:
Define a environment variable like ENABLE_GATSBY_REFRESH_ENDPOINT=true
and then run gatsby develop
Use curl -X POST http://localhost:8000/__refresh
to invoke a full refresh.
Alternatively, make it repeatedly call the hook to trigger a refresh periodically with watch -n5 "curl -X POST http://localhost:8000/__refresh"
(every 5 seconds in this case, tune as needed) or put it in a crontab for unattended refresh with longer intervals.
This solution was originally replied at: https://stackoverflow.com/a/60633434/8616125
PD: I cannot comment because I do not have enough reputation so I have to reply using a post instead a comment, my apologies.
Upvotes: 1