vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.04k stars 27k forks source link

HMR breaks in 13.4.3 and 13.4.4 (and in 13.4.8) when used with custom server #50881

Open firmableharry opened 1 year ago

firmableharry commented 1 year ago

Verify canary release

Provide environment information

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Home
    Binaries:
      Node: 18.0.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.4.4
      eslint-config-next: 13.0.0
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.0.2

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://github.com/vercel/next.js/tree/canary/examples/reproduction-template

To Reproduce

Install 13.4.3/13.4.4 Use a custom server Please have a look at WS in the network.

Nextjs-13 4 3_HMR-Issue

(sorry for not providing the reproduction repo, as its just 4 lines of custom server)

Describe the Bug

Using a custom dev server as I need https,

const hostName = 'productname.dev';
const port = 443;
const dev = true;
const app = next({ dev, dir: path.join(__dirname, '../'), hostname: hostName, port });

This setup works fine and HMR works as expected on 13.4.2, but fails on 13.4.3/13.4.4 and the latest 13.4.5-canary.6.HTTPS

Expected Behavior

HMR should work as normal and expected

Which browser are you using? (if relevant)

Chrome

How are you deploying your application? (if relevant)

Its a local only issue

KhuongDuy106 commented 1 year ago

Hi, so how to disable fast refresh on 404/500 page with next.js 13.4.4? Screenshot_1

firmableharry commented 1 year ago

Can some one have a look at this please? This issue still exist in 13.4.8

Here is the screenshot.

image

meds commented 1 year ago

Can confirm happening on 13.4.10 too, 13.4.7 was last version it's working on.

Currently it does update the UI but then does a full page refresh.

I don't think I'm using a custom server so it might be unrelated to that?

KhuongDuy106 commented 1 year ago

it won't happen in production mode

meds commented 1 year ago

it won't happen in production mode

Who is using HMR in prod and why are they?

meds commented 1 year ago

From a very brief test 13.4.11 looks to have fixed the issue for me

firmableharry commented 1 year ago

Still the same to me on both 13.4.11 and 13.4.12

image