vercel / next.js

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

Nextjs webpack build hot reload error - hot-reloader-client.tsx #48030

Closed Yard-Daniel closed 1 year ago

Yard-Daniel commented 1 year ago

Verify canary release

Provide environment information

Tested versions:
next@13.1.0
next@13.1.6
next@13.2.4
next@13.2.5-canary.32

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

No response

Link to the code that reproduces this issue

https://stackblitz.com/edit/vercel-next-js-chqhja?file=app%2Fpage.tsx

To Reproduce

Setup turbo monorepo with a nextjs13 project.

pnpm dev

The error mostly occurs and seldom disappears, because of the hot.module (not sure what triggers).

It fails in the nextjs13 webpack bundle.

Describe the Bug

error - uncaughtException: TypeError: Cannot read properties of undefined (reading 'length')
cfolio:dev:     at WasmHash._updateWithBuffer (/Users/bob/dev/nextjs13/node_modules/.pnpm/next@13.2.4_z72xxk7vwlamvgqemvc4ptm4du/node_modules/next/dist/compiled/webpack/bundle5.js:28:1352524)

file: packages/next/src/client/components/react-dev-overlay/hot-reloader-client.tsx line: 153

// current const hasUpdates = Boolean(updatedModules.leng

Screenshot 2023-04-06 at 17 40 34

th)

// should be const hasUpdates = Boolean(updatedModules && updatedModules.length)

// because error Boolean(null.length) // TypeError: Cannot read properties of null (reading 'length') obviously.

Expected Behavior

To run pnpm dev without issues from the nextjs13 build.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

shuding commented 1 year ago

I think this should have been fixed in the latest codebase, as we check !updatedModules here so it can't be null or undefined in the place you pointed out:

https://github.com/vercel/next.js/blob/eba1626b459504c8ef87a78b7dc8afaa7c6c591b/packages/next/src/client/components/react-dev-overlay/hot-reloader-client.tsx#L134-L151

Let us know if you still see it in the latest canary, thanks.

github-actions[bot] commented 1 year ago

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.