When running gatsby develop -H 0.0.0.0 inside a Docker container and then modify source files, it does not trigger a recompile.
For apps that use webpack's dev server (like CRA), the trick is to modify devServer.watchOptions to set poll: true - then triggering a recompile inside Docker when files change works fine. But if I understand correctly, Gatsby does not use webpacks dev server.
What is the way to set the watch mode to polling in Gatsby?
Host OS: Windows 10 Pro / Hyper-V
Docker Desktop 2.0.0.0-win81
Docker image used: node:10
System:
OS: Linux 4.9 Debian GNU/Linux 9 (stretch) 9 (stretch)
CPU: (2) x64 Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
Shell: 4.4.12 - /bin/bash
Binaries:
Node: 10.15.0 - /usr/local/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Languages:
Python: 2.7.13 - /usr/bin/python
npmPackages:
gatsby: ^2.0.76 => 2.0.85
gatsby-image: ^2.0.20 => 2.0.25
gatsby-plugin-manifest: ^2.0.9 => 2.0.13
gatsby-plugin-offline: ^2.0.16 => 2.0.20
gatsby-plugin-react-helmet: ^3.0.2 => 3.0.5
gatsby-plugin-sharp: ^2.0.14 => 2.0.17
gatsby-source-filesystem: ^2.0.8 => 2.0.12
gatsby-source-strapi: ^0.0.6 => 0.0.6
gatsby-transformer-sharp: ^2.1.8 => 2.1.10
Hey @theshire-io
gatsby uses chokidar under the hood and you should be able to enable polling by setting the CHOKIDAR_USEPOLLING=1 env var as documented in https://github.com/paulmillr/chokidar
Thank you @sidharthachatterjee !
I think I spent close to 8 (intermittent) hours the other day trying to solve this. I ended up going on a Webpack config wild goose chase.
THIS, good sir, is exactly what I was looking for.
Holy $h!+ THANK YOU @sidharthachatterjee for answering the question! And THANK YOU @theshire-io for asking it!
I second that. Thank you sir @sidharthachatterjee. Works a treat.
Most helpful comment
Hey @theshire-io
gatsby uses
chokidarunder the hood and you should be able to enable polling by setting theCHOKIDAR_USEPOLLING=1env var as documented in https://github.com/paulmillr/chokidar