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
db4f032d
Unverified
Commit
db4f032d
authored
Jul 13, 2022
by
Tim Neutkens
Committed by
GitHub
Jul 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure .client.tsx/.ts/.jsx Client Components can be imported (#38591)
parent
722e64f0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
2 deletions
+27
-2
webpack-config.ts
packages/next/build/webpack-config.ts
+2
-1
utils.ts
packages/next/build/webpack/loaders/utils.ts
+9
-1
client-comp.client.jsx
test/e2e/app-dir/app/app/dashboard/client-comp.client.jsx
+14
-0
page.server.js
test/e2e/app-dir/app/app/dashboard/page.server.js
+2
-0
No files found.
packages/next/build/webpack-config.ts
View file @
db4f032d
...
...
@@ -58,6 +58,7 @@ import { withoutRSCExtensions } from './utils'
import
browserslist
from
'next/dist/compiled/browserslist'
import
loadJsConfig
from
'./load-jsconfig'
import
{
loadBindings
}
from
'./swc'
import
{
clientComponentRegex
}
from
'./webpack/loaders/utils'
const
watchOptions
=
Object
.
freeze
({
aggregateTimeout
:
5
,
...
...
@@ -1311,7 +1312,7 @@ export default async function getBaseWebpackConfig(
},
},
{
test
:
/
(\.
client
\.(
js|cjs|mjs
))
$|
\/
next
\/(
link|image|future
\/
image|head|script
)
/
,
test
:
clientComponentRegex
,
issuerLayer
:
'sc_server'
,
use
:
{
loader
:
'next-flight-client-loader'
,
...
...
packages/next/build/webpack/loaders/utils.ts
View file @
db4f032d
export
const
defaultJsFileExtensions
=
[
'js'
,
'mjs'
,
'jsx'
,
'ts'
,
'tsx'
]
const
imageExtensions
=
[
'jpg'
,
'jpeg'
,
'png'
,
'webp'
,
'avif'
]
const
nextClientComponents
=
[
'link'
,
'image'
,
'head'
,
'script'
,
'dynamic'
]
const
nextClientComponents
=
[
'link'
,
'image'
,
// TODO-APP: check if this affects the regex
'future/image'
,
'head'
,
'script'
,
'dynamic'
,
]
const
NEXT_BUILT_IN_CLIENT_RSC_REGEX
=
new
RegExp
(
`[\\\\/]next[\\\\/](
${
nextClientComponents
.
join
(
'|'
)}
)\\.js$`
...
...
test/e2e/app-dir/app/app/dashboard/client-comp.client.jsx
0 → 100644
View file @
db4f032d
import
{
useEffect
,
useState
}
from
'react'
export
default
function
ClientComp
()
{
const
[
state
,
setState
]
=
useState
({})
useEffect
(()
=>
{
setState
({
test
:
'HELLOOOO'
})
},
[])
return
(
<>
<
p
>
Hello
</
p
>
{
state
.
test
}
</>
)
}
test/e2e/app-dir/app/app/dashboard/page.server.js
View file @
db4f032d
import
ClientComp
from
'./client-comp.client'
export
default
function
DashboardPage
(
props
)
{
return
(
<>
<
p
className
=
"p"
>
hello
from
app
/
dashboard
<
/p
>
<
p
className
=
"green"
>
this
is
green
<
/p
>
<
ClientComp
/>
<
/
>
)
}
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