Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alias next/head to noop for rsc and add upgration warning (#43885)
This will reduce the bundle size and also give user proper hint to upgrade to `head.js` * Mark `next/head` as noop in app dir * Add warning for users to check the upgration guide to migrate it to head.js
- Loading branch information
Showing
6 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { warnOnce } from '../../shared/lib/utils/warn-once' | ||
|
||
if (process.env.NODE_ENV !== 'production') { | ||
warnOnce( | ||
`You're using \`next/head\` inside app directory, please migrate to \`head.js\`. Checkout https://beta.nextjs.org/docs/api-reference/file-conventions/head for details.` | ||
) | ||
} | ||
|
||
export default function NoopHead() { | ||
return null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Head from 'next/head' | ||
|
||
export default function ClientHead() { | ||
return ( | ||
<Head> | ||
<meta content="dynamic" property="dynamic-head" /> | ||
</Head> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use client' | ||
|
||
import dynamic from 'next/dynamic' | ||
|
||
const ClientHead = dynamic(() => import('./client-head'), { ssr: false }) | ||
|
||
export default ClientHead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters