Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsc: mark next head as client component #36138

Merged
merged 2 commits into from Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/build/webpack/loaders/utils.ts
@@ -1,6 +1,6 @@
const defaultJsFileExtensions = ['js', 'mjs', 'jsx', 'ts', 'tsx', 'json']
const imageExtensions = ['jpg', 'jpeg', 'png', 'webp', 'avif']
const nextClientComponents = ['link', 'image', 'script']
const nextClientComponents = ['link', 'image', 'head', 'script']
shuding marked this conversation as resolved.
Show resolved Hide resolved

const NEXT_BUILT_IN_CLIENT_RSC_REGEX = new RegExp(
`[\\\\/]next[\\\\/](${nextClientComponents.join('|')})\\.js$`
Expand Down
@@ -1,12 +1,16 @@
import Nav from '../components/nav'
import Script from 'next/script'
import Head from 'next/head'

const envVar = process.env.ENV_VAR_TEST
const headerKey = 'x-next-test-client'

export default function Index({ header }) {
return (
<div>
<Head>
<meta name="rsc-title" content="index" />
</Head>
<h1>{`component:index.server`}</h1>
<div>{'env:' + envVar}</div>
<div>{'header:' + header}</div>
Expand Down
Expand Up @@ -18,6 +18,7 @@ export default function (context, { runtime, env }) {
const scriptTagContent = await browser.elementById('client-script').text()
// should have only 1 DOCTYPE
expect(homeHTML).toMatch(/^<!DOCTYPE html><html/)
expect(homeHTML).toMatch('<meta name="rsc-title" content="index"/>')
expect(homeHTML).toContain('component:index.server')
expect(homeHTML).toContain('env:env_var_test')
expect(homeHTML).toContain('header:test-util')
Expand Down