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
c613608b
Unverified
Commit
c613608b
authored
Jun 09, 2022
by
Shu Ding
Committed by
GitHub
Jun 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix client entry unexpectedly created in app dir (#37561)
fix client entry unexpectedly created
parent
0bfdf0e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
entries.ts
packages/next/build/entries.ts
+2
-1
hot-reloader.ts
packages/next/server/dev/hot-reloader.ts
+3
-1
on-demand-entry-handler.ts
packages/next/server/dev/on-demand-entry-handler.ts
+3
-1
No files found.
packages/next/build/entries.ts
View file @
c613608b
...
...
@@ -327,6 +327,7 @@ export async function createEntrypoints(params: CreateEntrypointsParams) {
}
const
isServerComponent
=
serverComponentRegex
.
test
(
absolutePagePath
)
const
isInsideAppDir
=
appDir
&&
absolutePagePath
.
startsWith
(
appDir
)
const
staticInfo
=
await
getPageStaticInfo
({
nextConfig
:
config
,
...
...
@@ -339,7 +340,7 @@ export async function createEntrypoints(params: CreateEntrypointsParams) {
page
,
pageRuntime
:
staticInfo
.
runtime
,
onClient
:
()
=>
{
if
(
isServerComponent
)
{
if
(
isServerComponent
||
isInsideAppDir
)
{
// We skip the initial entries for server component pages and let the
// server compiler inject them instead.
}
else
{
...
...
packages/next/server/dev/hot-reloader.ts
View file @
c613608b
...
...
@@ -563,6 +563,8 @@ export default class HotReloader {
const
isServerComponent
=
serverComponentRegex
.
test
(
absolutePagePath
)
const
isInsideAppDir
=
this
.
appDir
&&
absolutePagePath
.
startsWith
(
this
.
appDir
)
const
staticInfo
=
await
getPageStaticInfo
({
pageFilePath
:
absolutePagePath
,
...
...
@@ -593,7 +595,7 @@ export default class HotReloader {
},
onClient
:
()
=>
{
if
(
!
isClientCompilation
)
return
if
(
isServerComponent
)
{
if
(
isServerComponent
||
isInsideAppDir
)
{
entries
[
pageKey
].
status
=
BUILDING
entrypoints
[
bundlePath
]
=
finalizeEntrypoint
({
name
:
bundlePath
,
...
...
packages/next/server/dev/on-demand-entry-handler.ts
View file @
c613608b
...
...
@@ -206,6 +206,8 @@ export function onDemandEntryHandler({
const
isServerComponent
=
serverComponentRegex
.
test
(
pagePathData
.
absolutePagePath
)
const
isInsideAppDir
=
appDir
&&
pagePathData
.
absolutePagePath
.
startsWith
(
appDir
)
const
pageKey
=
`
${
type
}${
pagePathData
.
page
}
`
...
...
@@ -217,7 +219,7 @@ export function onDemandEntryHandler({
return
}
}
else
{
if
(
type
===
'client'
&&
isServerComponent
)
{
if
(
type
===
'client'
&&
(
isServerComponent
||
isInsideAppDir
)
)
{
// Skip adding the client entry here.
}
else
{
entryAdded
=
true
...
...
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