Closed rodamaral closed 8 months ago
The recent upgrade to Next 12.2 introduced an error in the console.
Warning: next-head-count is missing. https://nextjs.org/docs/messages/next-head-count-missing 5 [next-dev.js:24:25](webpack://_N_E/node_modules/.pnpm/next@12.2.0_tp5llvuvk3nymhndaus7enixm4/node_modules/next/dist/client/next-dev.js?cd99) error next-dev.js:24 updateElements head-manager.js:96 updateHead head-manager.js:42 updateHead head-manager.js:41 emitChange side-effect.js:12 SideEffect side-effect.js:45 Preact 2
It also causes a undefined tag to appear in the body:
Relevant package.json sections:
{ "dependencies": { "next": "12.2.0", "next-plugin-preact": "^3.0.7", "preact": "^10.7.1", "preact-render-to-string": "^5.1.21", "react": "npm:@preact/compat@17.0.3", "react-dom": "npm:@preact/compat@17.0.3", "react-ssr-prepass": "npm:preact-ssr-prepass@^1.2.0" }, "devDependencies": { "@prefresh/babel-plugin": "^0.4.0", "preact-ssr-prepass": "^1.2.0", "webpack": ">=4.0.0 <5.0.0 || >=5.0.0 <6.0.0" }, "peerDependencies": { "@prefresh/babel-plugin": "^0.4.0", "preact-ssr-prepass": "^1.2.0" } }
pages/_document.tsx
import Document, { Head, Html, Main, NextScript } from 'next/document' export default class MyDocument extends Document { render() { return ( <Html> <Head> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&display=optional" rel="stylesheet" /> </Head> <body> <Main /> <NextScript /> </body> </Html> ) } }
pages/index.tsx
import type { NextPage } from 'next' import Head from 'next/head' import { Header } from '~/components/Header' import { HomeMain } from '~/components/HomeMain' const Home: NextPage = () => ( <> <Head> <title>TITLE</title> <meta name="description" content="DESCRIPTION" /> </Head> <Header /> <HomeMain /> </> ) export default Home
same issue with next 12.2.0 & preact 10.8.2
next 12.2.0
preact 10.8.2
Fixed https://github.com/vercel/next.js/pull/38252
The recent upgrade to Next 12.2 introduced an error in the console.
It also causes a undefined tag to appear in the body:
Relevant package.json sections:
pages/_document.tsx
pages/index.tsx