next.js
next.js copied to clipboard
next/head crashes app
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
next info
Operating System:
Platform: linux
Arch: x64
Version: Ubuntu 20.04.0 LTS Wed Oct 26 2022 00:51:29 GMT-0300 (Horário Padrão de Brasília)
Binaries:
Node: 16.14.2
npm: 7.17.0
Yarn: 1.22.19
pnpm: 7.13.6
Relevant packages:
next: 12.3.2-canary.43
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
What browser are you using? (if relevant)
firefox
How are you deploying your application? (if relevant)
next dev
Describe the Bug
When using the Head component, this error is thrown in the console:
TypeError: Cannot read property '' of undefined
at resolveModuleReference (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:46:58)
at resolveModule (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:646:25)
at processFullRow (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:735:9)
at processBinaryChunk (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:789:5)
at progress (C:\projects\javascript\personal\edp-totem\node_modules\next\dist\compiled\react-server-dom-webpack\client.js:842:5)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
Expected Behavior
To work properly without any errors
Link to reproduction
https://stackblitz.com/edit/vercel-next-js-vjs4ah?file=src/app/layout.tsx
To Reproduce
Create a root layout in app folder that adds a Head component
Actually this is happening when I use Link
too
@darklight9811 After some digging around I noticed that the new way to use this is creating a head.tsx
file next to the page: https://beta.nextjs.org/docs/routing/pages-and-layouts#modifying-head
Not fully sure what I think about it yet though 😅 It's nice.... But having these extra files is also not? 😬
Thanks, we are working on updating the beta documentation at https://beta.nextjs.org/docs/api-reference/file-conventions/head to address this.
@balazsorban44 update the eslint rules, to avoid using the native head
html and stop recommending the Head component
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.