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
8725b6c3
Unverified
Commit
8725b6c3
authored
May 25, 2023
by
Jiachi Liu
Committed by
GitHub
May 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing react-dom/client alias (#50324)
Fixes #50312 fix NEXT-1235
parent
46369f57
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
12 deletions
+20
-12
webpack-config.ts
packages/next/src/build/webpack-config.ts
+1
-0
app-alias.test.ts
test/e2e/app-dir/app-alias/app-alias.test.ts
+18
-7
next.config.js
test/e2e/app-dir/app-alias/next.config.js
+0
-1
aaa.js
test/e2e/app-dir/app-alias/src/pages/aaa.js
+0
-3
tsconfig.json
test/e2e/app-dir/app-alias/tsconfig.json
+1
-1
No files found.
packages/next/src/build/webpack-config.ts
View file @
8725b6c3
...
...
@@ -402,6 +402,7 @@ function createReactAliases(
'react-dom$'
:
`next/dist/compiled/react-dom
${
bundledReactChannel
}
`
,
'react/jsx-runtime$'
:
`next/dist/compiled/react
${
bundledReactChannel
}
/jsx-runtime`
,
'react/jsx-dev-runtime$'
:
`next/dist/compiled/react
${
bundledReactChannel
}
/jsx-dev-runtime`
,
'react-dom/client$'
:
`next/dist/compiled/react-dom
${
bundledReactChannel
}
/client`
,
'react-dom/server$'
:
`next/dist/compiled/react-dom
${
bundledReactChannel
}
/server`
,
'react-dom/server.edge$'
:
`next/dist/compiled/react-dom
${
bundledReactChannel
}
/server.edge`
,
'react-dom/server.browser$'
:
`next/dist/compiled/react-dom
${
bundledReactChannel
}
/server.browser`
,
...
...
test/e2e/app-dir/app-alias/app-alias.test.ts
View file @
8725b6c3
import
{
createNextDescribe
}
from
'e2e-utils'
import
path
from
'path'
createNextDescribe
(
'app-dir alias
handling
'
,
'app-dir alias'
,
{
files
:
__dirname
,
packageJson
:
{
...
...
@@ -10,7 +9,7 @@ createNextDescribe(
},
skipDeployment
:
true
,
},
({
next
,
isNext
Dev
})
=>
{
({
next
,
isNext
Start
})
=>
{
it
(
'should handle typescript paths alias correctly'
,
async
()
=>
{
const
html
=
await
next
.
render
(
'/button'
)
expect
(
html
).
toContain
(
'click</button>'
)
...
...
@@ -24,12 +23,24 @@ createNextDescribe(
expect
(
fontSize
).
toBe
(
'50px'
)
})
if
(
!
isNextDev
)
{
if
(
isNextStart
)
{
it
(
'should not contain installed react/react-dom version in client chunks'
,
async
()
=>
{
const
appBuildManifest
=
await
next
.
readJSON
(
'.next/app-build-manifest.json'
)
Object
.
keys
(
appBuildManifest
.
pages
).
forEach
((
page
)
=>
{
const
containFrameworkChunk
=
appBuildManifest
.
pages
[
page
].
some
(
(
chunk
)
=>
{
return
chunk
.
includes
(
'framework'
)
}
)
expect
(
containFrameworkChunk
).
toBe
(
false
)
})
})
it
(
'should generate app-build-manifest correctly'
,
async
()
=>
{
// Remove other page CSS files:
const
manifest
=
await
next
.
readJSON
(
path
.
join
(
'.next'
,
'app-build-manifest.json'
)
)
const
manifest
=
await
next
.
readJSON
(
'.next/app-build-manifest.json'
)
expect
(
manifest
.
pages
).
not
.
toBeEmptyObject
()
})
...
...
test/e2e/app-dir/app-alias/next.config.js
deleted
100644 → 0
View file @
46369f57
export
default
{}
test/e2e/app-dir/app-alias/src/pages/aaa.js
deleted
100644 → 0
View file @
46369f57
export
default
function
Page
()
{
return
<
h1
>
aaa
<
/h1
>
}
test/e2e/app-dir/app-alias/tsconfig.json
View file @
8725b6c3
...
...
@@ -25,5 +25,5 @@
]
},
"include"
:
[
"next-env.d.ts"
,
"**/*.ts"
,
"**/*.tsx"
,
".next/types/**/*.ts"
],
"exclude"
:
[
"node_modules"
]
"exclude"
:
[
"node_modules"
,
"**/*.test.ts"
]
}
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