Unverified Commit 8725b6c3 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Add missing react-dom/client alias (#50324)

Fixes #50312
fix NEXT-1235
parent 46369f57
......@@ -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`,
......
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, isNextDev }) => {
({ next, isNextStart }) => {
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()
})
......
export default function Page() {
return <h1>aaa</h1>
}
......@@ -25,5 +25,5 @@
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "**/*.test.ts"]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment