next.js: HMR -- can't find hot-update.json.

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

using:

  • zeit/next-sass for my next.config.js
  • a custom server.js with a custom directory
    • const application = next({ dev, dir: './src' });
  • Flow js for type checking
  • Redux and Apollo

I have just updated to next 6.0.0 and I can’t use my site because the HMR fails to find any information, causing any route requests to result in a full reload.

The site works when loaded with yarn build && yarn start

Folder structures:

./src
  /pages
    /apps
      /Public
        index.js
        sign_in.js
        sign_up.js
        forgot_password.js
      /Admin
        .......

EDIT:

It seems like the files are supposed to go directly into .next I see that happening in a small test repo that I made. However, it now seems that if that’s the case, the error I’m encountering is actually the fact that the HMR is unable to find the hot-update.json files when updates are made.

END EDIT


When on page /apps/Public/sign_in as /sign_in I click on <Link to="/apps/Public/forgot_password" as="forgot_password" />

Result:

image

Initial page loads of all pages works perfectly. However, any route changes fail.

Debugging

I have tried just about everything I can think of. It seems like this error is caused from my ./src/.next file not having a /webpack directory. My understanding is that HMR will look for the hot-update.json files in /webpack

However, in my case, all hot-update.json files are in ./src/.next

image

Contents of ./src/.next

image

Questions:

  • Why do I not have a /webpack directory?
  • I can’t create a reproduction repo, can someone from Zeit help by looking through my private repo?

Your Environment

Tech Version
next 6.0
node 9.11.1
OS Mac OS
browser Chrome

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@timneutkens Update: tried with canary, still same result. My guess its something to do with integrating to my the existing express app, but can’t quite figure out the issue.

After some more digging, I found that eventually the hot-update file does get written to disk, but only after something causes a change (building a new page, or old page is disposed). It seems like the hot-update.json files on disk are always one step behind the file being requested from the client.

error-console screen shot 2018-08-28 at 2 49 35 pm

I’m not too familiar with how webpack-dev-middleware works, but are the files supposed to be on disk before they can be served, or does the middleware serve them from memory? Trying to figure if maybe something is preventing them from being written to the disk at the right time.