Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
953cd9af
Unverified
Commit
953cd9af
authored
Apr 13, 2022
by
Jiachi Liu
Committed by
GitHub
Apr 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsc: mark next head as client component (#36138)
Follow up of #36135 Add `next/head` as client component
parent
a5103d2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
1 deletion
+6
-1
utils.ts
packages/next/build/webpack/loaders/utils.ts
+1
-1
index.server.js
...streaming-and-server-components/app/pages/index.server.js
+4
-0
rsc.js
...gration/react-streaming-and-server-components/test/rsc.js
+1
-0
No files found.
packages/next/build/webpack/loaders/utils.ts
View file @
953cd9af
const
defaultJsFileExtensions
=
[
'js'
,
'mjs'
,
'jsx'
,
'ts'
,
'tsx'
,
'json'
]
const
defaultJsFileExtensions
=
[
'js'
,
'mjs'
,
'jsx'
,
'ts'
,
'tsx'
,
'json'
]
const
imageExtensions
=
[
'jpg'
,
'jpeg'
,
'png'
,
'webp'
,
'avif'
]
const
imageExtensions
=
[
'jpg'
,
'jpeg'
,
'png'
,
'webp'
,
'avif'
]
const
nextClientComponents
=
[
'link'
,
'image'
,
'script'
]
const
nextClientComponents
=
[
'link'
,
'image'
,
'
head'
,
'
script'
]
const
NEXT_BUILT_IN_CLIENT_RSC_REGEX
=
new
RegExp
(
const
NEXT_BUILT_IN_CLIENT_RSC_REGEX
=
new
RegExp
(
`[\\\\/]next[\\\\/](
${
nextClientComponents
.
join
(
'|'
)}
)\\.js$`
`[\\\\/]next[\\\\/](
${
nextClientComponents
.
join
(
'|'
)}
)\\.js$`
...
...
test/integration/react-streaming-and-server-components/app/pages/index.server.js
View file @
953cd9af
import
Nav
from
'../components/nav'
import
Nav
from
'../components/nav'
import
Script
from
'next/script'
import
Script
from
'next/script'
import
Head
from
'next/head'
const
envVar
=
process
.
env
.
ENV_VAR_TEST
const
envVar
=
process
.
env
.
ENV_VAR_TEST
const
headerKey
=
'x-next-test-client'
const
headerKey
=
'x-next-test-client'
...
@@ -7,6 +8,9 @@ const headerKey = 'x-next-test-client'
...
@@ -7,6 +8,9 @@ const headerKey = 'x-next-test-client'
export
default
function
Index
({
header
})
{
export
default
function
Index
({
header
})
{
return
(
return
(
<
div
>
<
div
>
<
Head
>
<
meta
name
=
"rsc-title"
content
=
"index"
/>
<
/Head
>
<
h1
>
{
`component:index.server`
}
<
/h1
>
<
h1
>
{
`component:index.server`
}
<
/h1
>
<
div
>
{
'env:'
+
envVar
}
<
/div
>
<
div
>
{
'env:'
+
envVar
}
<
/div
>
<
div
>
{
'header:'
+
header
}
<
/div
>
<
div
>
{
'header:'
+
header
}
<
/div
>
...
...
test/integration/react-streaming-and-server-components/test/rsc.js
View file @
953cd9af
...
@@ -18,6 +18,7 @@ export default function (context, { runtime, env }) {
...
@@ -18,6 +18,7 @@ export default function (context, { runtime, env }) {
const
scriptTagContent
=
await
browser
.
elementById
(
'client-script'
).
text
()
const
scriptTagContent
=
await
browser
.
elementById
(
'client-script'
).
text
()
// should have only 1 DOCTYPE
// should have only 1 DOCTYPE
expect
(
homeHTML
).
toMatch
(
/^<!DOCTYPE html><html/
)
expect
(
homeHTML
).
toMatch
(
/^<!DOCTYPE html><html/
)
expect
(
homeHTML
).
toMatch
(
'<meta name="rsc-title" content="index"/>'
)
expect
(
homeHTML
).
toContain
(
'component:index.server'
)
expect
(
homeHTML
).
toContain
(
'component:index.server'
)
expect
(
homeHTML
).
toContain
(
'env:env_var_test'
)
expect
(
homeHTML
).
toContain
(
'env:env_var_test'
)
expect
(
homeHTML
).
toContain
(
'header:test-util'
)
expect
(
homeHTML
).
toContain
(
'header:test-util'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment