Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot module replacement not working with the default starter #1769

Closed
Kurren123 opened this issue Aug 11, 2017 · 28 comments
Closed

Hot module replacement not working with the default starter #1769

Kurren123 opened this issue Aug 11, 2017 · 28 comments

Comments

@Kurren123
Copy link

Windows 10, Chrome 60.0.3112.90. I run:

gatsby new gatsby-site
cd gatsby-site
gatsby develop

I edit the file src/pages/index.js from <h1>Hi people</h1> to <h1>Hi people 123</h1>. No change is shown in the browser unless I refresh the page. No error is shown on the command line, only:

 DONE  Compiled successfully in 379ms                                                                                                                                                    9:40:47 AM

 I  Your site is running at http://localhost:8000
 I  Your graphql debugger is running at http://localhost:8000/___graphql

Only the following js errors are reported on the web page itself:

lowPriorityWarning.js:40 Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in  React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs
printWarning @ lowPriorityWarning.js:40
:8000/favicon.ico Failed to load resource: the server responded with a status of 404 (Not Found)
@dethi
Copy link

dethi commented Aug 12, 2017

Hi,

  • What is your current version of gatsby? (run gatsby -V in the root directory of your project)
  • Did you try in incognito mode? (maybe an extension is blocking the websocket)

@Kurren123
Copy link
Author

Hi @dethi. Still doesn't work after an npm upgrade or in incognito mode. My package.json file is:

{
  "name": "gatsby-starter-hello-world",
  "description": "Gatsby hello world starter",
  "license": "MIT",
  "scripts": {
    "develop": "gatsby develop",
    "build": "gatsby build",
    "serve": "gatsby serve"
  },
  "dependencies": {
    "gatsby": "1.8.4",
    "gatsby-link": "1.6.7"
  }
}

@Kurren123
Copy link
Author

@dethi please also note that the react hot boiler plate example does work for me.

@billy-le
Copy link

I'm having this issue on a Windows environment.

gatsby develop boots fine. I just don't get any hot reload. When I change files, they are compile successfully but no hot reloading is done.

I'm on Gatsby 1.1.13 and using node 8.7

I used npm i gatsby-cli -g to install gatsby.

@thibmaek
Copy link
Contributor

thibmaek commented Nov 5, 2017

Can definitely back this up, does not work when installing from scratch.

@jamieguerrero
Copy link

I am also experiencing this issue with a previous gatsby project which HMR has worked for in the past.

@GramParallelo
Copy link
Contributor

GramParallelo commented Nov 20, 2017

hmmm me tooo : / (as reference, hmr works on a clean install of create-react-app)
EDIT: upon further inspection - browser console outputs CORS error, could it be a wepack-dev-server issue?

@brandonjcreek
Copy link

I too am running into this issue when running gatsby develop from a Windows machine.

Node is currently at 9.2.0
Gatspy is currently at 1.9.118

Chrome is throwing the following error in console:
GET http://0.0.0.0:8000/__webpack_hmr net::ERR_ADDRESS_INVALID

@kripod
Copy link
Contributor

kripod commented Nov 21, 2017

@KyleAMathews The issue is that on Windows, localhost should be used instead of 0.0.0.0 for development. Since some update which happened during the last few days, all of my webpack-imported resources are being loaded from 0.0.0.0, which is incorrect for Windows users.

@mewdriller
Copy link

mewdriller commented Nov 21, 2017

As @kripod mentioned, it looks like the issue is that program.host is coming in as 0.0.0.0 on Windows here.

@KyleAMathews
Copy link
Contributor

This should be fixed now #2983

@thibmaek
Copy link
Contributor

My issue was actually occurring on macOS High Sierra (latest stable).

@rdela
Copy link
Contributor

rdela commented Nov 21, 2017

@thibmaek same deal see #2960 (comment) for more

@Kurren123
Copy link
Author

Hi @KyleAMathews. The issue still seems to be there. Windows 10 Chrome gatsby 1.1.27.

@rdela
Copy link
Contributor

rdela commented Dec 13, 2017

@Kurren123 can you try with Gatsby 1.9.131
https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/package.json#L4

and gatsby-cli 1.1.27
https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-cli/package.json#L4

…please? If bug persists, what is happening? 0.0.0.0 error? what is your develop command? did you try setting --host/-H localhost? Or use your local IP? What works and what fails?

@Cu3PO42
Copy link

Cu3PO42 commented Jan 26, 2018

It's not working for me either.

I have gatsby-cli 1.1.31 and have tried setting -H localhost explicitly.
I have tried with Chrome (Canary) and Firefox (Dev Edition) and got the same results.
This is on Windows Server 2008 R2 (please don't ask).

The behavior I'm seeing specifically is that no hot reloading takes place, however the browser complains about a lost connection to the HMR endpoint when I stop gatsby develop.
I'm getting none of the normal HMR output while it is running however.

It works just fine for the project in a Fedora 27 VM. At this point I'm all out of ideas unfortunately :(

@davidwesst
Copy link

It looks like the browser (i.e. client) is the cause of the issue on Windows. When I load up the starter using Microsoft Edge, I see the following message in the console: webpack-hot-middleware's client requires EventSource to work. You should include a polyfill if you want to support this browser.

Both Chrome and Firefox appear to support Server-Side Events (reference) and when I loaded it up in Chrome the hot reload worked as expected.

It looks like the MS Edge status for the feature is "Under Consideration", but until that changes we'll either have to refresh the page manually, add a polyfill, or use a different browser.

@Cu3PO42
Copy link

Cu3PO42 commented Jan 29, 2018

I don't see how that could be the case in my particular instance since I tried all of Chrome, Chrome Canary, Firefox and Firefox Dev Edition (all up to date).

@sant123
Copy link

sant123 commented Feb 16, 2018

With gatsby version 1.9.200 in Windows 10. It doesn't work.

image

@tetreault
Copy link

@KyleAMathews I am having this same issue, except the issue only occurs in Firefox v59.0.2. I noticed the issue because FF is the only browser not rendering my fonts, otherwise everything is fine... so strange. Screenshot of the console logs:

screenshot 2018-04-27 09 16 21

@tetreault
Copy link

tetreault commented Apr 27, 2018

also wanted to chime in that gatsby, while loading my fonts in chrome and safari, also wont load the fonts in mobile safari, mobile chrome, and mobile FF on iOS. I'm not seeing any error pop up though in the mobile safari inspector.

@tetreault
Copy link

just chiming in with even more info -- inside the generated styles.css file from npm run build I can find the imports of my font files in there, and I see the font files placed in the /static/ folder. so for the life of me I can't figure out why my font-family rules wont work or why these font files arent present when i check the inspector for mobile safari (at least FF had a console error pop up)

@tetreault
Copy link

finally resolved this using the typefaces method.

@fardarter
Copy link
Contributor

I'm also seeing this fail. Can't add an error because I'm not getting any – just no HMR.

@saostad
Copy link

saostad commented Jul 26, 2018

same problem here:

{
  "name": "gatsby-starter-hello-world",
  "description": "Gatsby hello world starter",
  "license": "MIT",
  "scripts": {
    "develop": "gatsby develop",
    "build": "gatsby build",
    "serve": "gatsby serve"
  },
  "dependencies": {
    "gatsby": "next",
    "react": "^16.3.2",
    "react-dom": "^16.3.2"
  }
}

this is a screeshot of my firefox network tab for error:
gatsbyhotreloadingerror

I don't know it help or no but this is the link to when I click on ? icon in that page.

@fardarter
Copy link
Contributor

fardarter commented Jul 26, 2018 via email

@saostad
Copy link

saostad commented Jul 26, 2018

what do you mean new repo? Go figure! ?

@saostad
Copy link

saostad commented Jul 27, 2018

I find out hot reloading works with plugins and transformers but if you change data in your react component, it's not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests