marcus-grant/pattern-buffer

`gatsby develop` doesn't detect changes and recompile when file changes are made

marcus-grant opened this issue · 2 comments

Changes aren't being detected or acted on if they are and so no compilation happens when changes are made and completely removes most utility offered by the integrated dev-server.

Problem: This issue from the gatsby repo on github details some of the problem, and it appears that due to some internal logic with which route is given by default to the internal networking, localhost isn't used and so somehow file watching is ignored.

Solution: By specifying localhost as the hosting route, (and not specifying port because that breaks it as well) makes the dev server network as expected. Then to address the file watching issue, the chokidar repo suggests enforcing synchronous file watching, though more taxing on the system can enforce more reliable file watching. Enabling it in the script dev-server stored in the project root addresses this. Altogether there's two lines that make the script have the server working. Use the below command to start the dev server properly:

export CHOKIDAR_USEPOLLING=1
gatsby develop --host localhost

Commit above fixes issue by creating an alternate bash script to run that properly starts the dev server and has it functioning as intended.